Nerseus
*Experts*-
Posts
2607 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Nerseus
-
I want WordPerfect 5.1 back :( (I still wish MS Word had "Reveal Codes" to fix whatever it does to my formatting) Any word on when it goes Gold? In 2003, or pushed back? -Nerseus
-
Hmmm... I think you can just declare your own struct, as in: public struct ColorType { public byte b; public byte g; public byte r; public byte a; public ColorType(byte r, byte g, byte b) { this.r = r; this.g = g; this.b = b; this.a = 255; } public ColorType(Color c) { this.r = c.R; this.g = c.G; this.b = c.B; this.a = c.A; } } At least, that's what I used for returns to the LockRectangle call. The SDK might have a default color struct defined, I can't remember offhand. -nerseus
-
All external Dll references must be static. In C# the keyword is static, I'm not sure if it's the same in VB.NET (I think it might be Shared?). Also, I don't think the params should be ByRef for those functions. And I think it should return an Int32, not Boolean (though Bool *might* work, I wouldn't count on it). -Nerseus
-
If you want an entire database copied, I'd use the built in tools of the database (Access and SQL Server both have tools to do this - Access is called file copy :)) If you really MUST do it in code, you *could* loop through every table and get all rows in a DataSet then use a DataAdapter to do INSERT them all into the second database. That would work if the database were small. For larger databases, you'd probably need a cursor to loop through all the rows in one Database and copy them. This also requires copying tables in the right order, if you have any foreign keys. Also, you'll need custom code per table to keep the foreign keys in sync. OR, turn off identity columns as you do your inserts. If you also need to copy the structure, then... well, you'd better ask :) -nerseus
-
What's the error message? What do the Update, Insert, Delete strings look like (you can use Debug.WriteLine to view them)? -Nerseus
-
Do you need Find because you're databinding individual controls (using BindingContext and Position)? If you just need to get access to the row to look at some values, you can use the DataTable's Select method (which allows a sort, filter, etc. and returns a DataRow array). -nerseus
-
AllowDBNull property of DataColumn
Nerseus replied to iaroslav's topic in Database / XML / Reporting
How are you filling your DataSet? You might need to call FillSchema first. If you load from a predefined dataset, such as an XSD, it usually contains that info as well (of course, it depends on how you create your XSD, if you do it that way). -Nerseus -
I don't think you want inheritance if I understand what you want. If you have 3 objects, A B and C, and each holds the data (and presumably methods) for a single table, I would think you'd want object D to have member variables for each of the 3 classes. So class D might look like (simplified): public class D { private ClassA myA; private ClassB myB; private ClassC myC; } You might expose them as public, or only allow certain methods of each object to get called. To do that, you'd create methods in D that have the same name and params as a method in A B or C and just call the method in A B or C. That way you can limit what methods or properties you want to expose. To implement a save in D, it would simply call Save on myA, myB, and myC. -Nerseus
-
First, change the line to (I removed the comma): lstOutput.Items.Add("Payroll results for " & empName) In all the rest of your functions, you're not returning anything. For example, change the State Tax function to: Function State_Tax(ByRef grossPay As Single, ByRef stateTax As Single) As Single 'Compute amount to be taken for State Tax State_Tax = grossPay * stateTax End Function You return a value by setting the function name (State_Tax in this case) to a value. You DID do that Gross_Pay which is why it's working. What does your UI look like? Are you using DataSets? To help you limit them to 4 employees, I need more info on how you're storing the 4 you've got. (Grid entry, textboxes, etc.) -Nerseus
-
That's not true at all - you can definitely use the OleDbConnection object to connect to SQL Server. The SQL Server specific connection offers better performance and some extra features (I don't know them offhand, only read about them) which is why you usually code against it when connecting to SQL Server. But Volte has a good point about making your connection code generic, to a point. You can code an abstraction layer which uses IDbConnection or you can simply wrap the Connection and other DB Specific calls somehow (maybe a webservice, maybe a class, who knows). You normally don't care how you get the data, just that it ends up in a DataSet (for example) and can be used to update the database eventually. -Nerseus
-
TroubleShotting working with Data Set
Nerseus replied to invertiamx's topic in Database / XML / Reporting
Other than sorting in the Database itself (add an ORDER BY clause to your SQL), I don't think the DataSet will sort internally - at least, I've never seen a method to do it. You might be able to manually loop and save off data rows and add them back in sorted, but I don't know that there's any guarantee that they'll be sorted in the DataTable. I think your best bet is to use a DataView whenever you need a sorted view of your data. The DataView is perfect for binding, and you don't have to create a new one. Every DataTable has a DefaultView property which is a DataView associated to the table. You can directly change it's sorting - but to see it, you STILL have to go through the DefaultView property (for binding, for instance). -Nerseus -
I'm not sure what you want, Diesel... If you declare a variable as Employee and set it equal to an instance of HourlyEmployee, of course you can't access the HourlyEmployee's members (if they're specific to HourlyEmployee). On the other hand, if HourlyEmployee overrides a method in Employee and you try and call the method on your Employee variable, it will STILL call the HourlyEmployee's version (even though the variable is of type Employee). That's not really what you asked, but I was clarifying what divil said. I think your original question was how do you assign a variable to the base class's type, which you've already done as soon as you did: HourlyEmployee hEmployee = new HourlyEmployee(); Employee emp = hEmployee; The second line is what you asked for, no? -Nerseus
-
Can you post your test project with the animated .x file? Try converting to a text .X file rather than the default binary version (it's a command line option, I believe, of the conv3ds tool). Then you can look at the x file in a text editor and see if you spot the animation data (they keyframes). Compare to the tiny.x file that comes with the DX SDK (I think it's tiny.x, that contains the walking animation). -Nerseus
-
Can you get the surface detached? That basically removes the surface from video memory and puts it in system memory so that the LockRect (reading the pixels) will be faster. If you search the following folder for LockRect you'll see it used in a few places: C:\DXSDK\Samples\C++\ I've used it in C# to much success, though I've locked a surface attached to a texture. I've never tried detaching the surface from the device. Here's a code snippet from ...\Common\Src\d3dfont.cpp (the block below says c#, but the code is C++): D3DLOCKED_RECT d3dlr; m_pTexture->LockRect( 0, &d3dlr, 0, 0 ); BYTE* pDstRow; pDstRow = (BYTE*)d3dlr.pBits; WORD* pDst16; BYTE bAlpha; // 4-bit measure of pixel intensity DWORD x, y; for( y=0; y < m_dwTexHeight; y++ ) { pDst16 = (WORD*)pDstRow; for( x=0; x < m_dwTexWidth; x++ ) { bAlpha = (BYTE)((pBitmapBits[m_dwTexWidth*y + x] & 0xff) >> 4); if (bAlpha > 0) { *pDst16++ = (WORD) ((bAlpha << 12) | 0x0fff); } else { *pDst16++ = 0x0000; } } pDstRow += d3dlr.Pitch; } -Nerseus
-
TroubleShotting working with Data Set
Nerseus replied to invertiamx's topic in Database / XML / Reporting
To add to Wjousts's comment, if you want a sorted view on the client, they'll have to load the DS into a DataView and sort it. If it's for binding, you can bind to the sorted DataView. -Nerseus -
Pixel Perfect Collision Detection in GDI+
Nerseus replied to Darc's topic in Graphics and Multimedia
And the code...? -nerseus -
Pixel Perfect Collision Detection in GDI+
Nerseus replied to Darc's topic in Graphics and Multimedia
What code are you using? Are you using the Image or BackgroundImage property? -nerseus -
Exposing DLL classes to .NET?
Nerseus replied to Nerseus's topic in Interoperation / Office Integration
A small update. I did manage to get the DLL created using .NET (non-managed) and it worked like a charm. I then created a C# class library and exposed it as a COM object (set of objects really) and created and used that COM object from C++. It's not pretty, but it works. And now that the foundation is done, I can do all the "real" work in C#. Performance hasn't been an issue yet, even with the extra layers (going to a second DLL AND a COM wrapper for my .NET objects). And I learned far too much (and yet so little) about COM in C++. Ugh. Something I'll have forgotten by New Years. -Nerseus -
I'm not sure what you're saying. Did you read my post? Does it make sense? The IndexOf does include the position of the CR characters. When you use a RichTextbox and press enter, it doesn't store the LF - only the CR. And IndexOf DOES see those characters. What do you mean by "how do I deal with this" and "get the absolute location of a specific string of text"? I'd have to answer IndexOf... -nerseus
-
Mouse driver for universal and intelligent scrolling behaviour with wheel
Nerseus replied to gicio's topic in Water Cooler
I'm not sure I understand you right. If you have a Microsoft mouse with the Intellipoint software installed, any applications you develop that have scrollbars (for instance), should let you scroll with the mouse wheel automatically. Are you saying you want to provide that scrolling ability to people with non-MS mice? Or are you saying you have some Windows application that you've created where the mouse wheel isn't working, such as a custom drawn control or the scrollbar controls? -Nerseus -
How much programming experience do you have? How much in .NET? There are a number of emulator programms on the market. Why not just buy one if that's what your company needs? There are also a number of custom controls that act as emulators that you might look into as well. To create an emulator from scratch is a VERY big task. It involves talking through the network at a semi-low level to access the data and handle the drawing yourself (not GDI, but handling the cursor placement and text placement, etc.). It's not something that should be taken up as a week or two project. I think I used a product from JRiver a few years ago. I may be confusing it with something else though :) We talked to IBM 3270 terminals and also to a custom mainframe based application through telnet. It was ugly. Now if you want to actually write something to be used on an emulator, that's another story. I was assuming you wanted your app to communicate with a server. -nerseus
-
Also, if you start with the wizard application that DirectX 9 creates, you'll see a TON of code. I noticed an ArcBall class that comes with one of the wizards. For some reason, they didn't use that class in the sample, but it contained all of the code to let you use the mouse to move a camera around a scene. Also, we at the forums are glad to help with specific questions once you get started. For example, start with one of the sample projects and tweak it a bit to see how things work. You'll quickly find the C++ documentation will give you about 90% of what you need in terms of objects and methods and such. The other 10% will probably be debugging since things are never quite as easy as you might expect in DX. That's where we all come in :) -Ner
-
I don't think you're going to get the antialiasing on a region. The drawing works because it can compare the edge pixels to what's currently on the screen (or on the graphical device you're drawing to) and blend them accordingly. On a region, it's just a pure "this pixel is in or out" kind of test. Now you might be able to manually examine those pixels along the edge and blend them yourself, but that sounds like a LOT of work and using the .NET functions to read/write pixels, performance isn't going to be realtime. If you know more about the region outside of your region, such as if it's always black, you could make some assumptions and blend things easier. -Nerseus
-
Need an ID that is unique across tables
Nerseus replied to discocarp's topic in Database / XML / Reporting
Personally, I like int values for keys whenever possible. If you ever need to look at data "in the raw", it's a major pain to match up a 32 character GUID (I've used them only on one project) :) About transactions: Normally, you should keep your transactions as small as required. Meaning, if you're doing a dataload it's often thought that all records must go in clean and thus the whole thing should be one transaction. But often you can get away with much smaller transactions. If you are dealing with an import type of application (rather than data entry), it's often a good idea to have a "scrubbing" area. Basically it's a set of tables that hold the imported data with a simple flag to indicate whether it's been read in clean or not. After a load, you can run a query to see how many bad records there are. -Nerseus -
If you just want to get the value for one row, you can cast the column as a DateTime and then do your DateDiff as normal. Something like: Dim d1 As Datetime = DirectCast(Ds1.Tables("Table").Columns("total"), DateTime) Dim d2 As DateTime = DirectCast(Ds1.Tables("Table").Columns("total"), DateTime) ' Now use d1 and d2 to get the DateDiff I may be off on how to use DirectCast - I'm not that familiar with VB.NET. Now if you want a 3rd column to be the DateDiff, it might be a bit harder. An expression column can use functions, but they're limited and I don't think DateDiff is one of them. If you need that, I'd really think about doing it in the query. If you need it dynamic, like what an expression column gives you, you may have to play around with a couple of functions (if there are any Datepart functions or a Month() or Day() function). You could also "fake" an expression column if nothing else works. You can setup a ColumnChanged event on your DataTable and whenever one of the two date columns changes, update a 3rd int column with the date difference. Not as clean as an expression column, but might be your only answer. -Ner