Nerseus
*Experts*-
Posts
2607 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Nerseus
-
I'm not sure what you mean by a collection of DataViews... Each DataTable has a single built-in DataView (accessed through the DefaultView property). You can also create new DataViews from a table by using the following syntax, though the reference is only in the variable - the dataset has no knowledge of the DataView: DataView dv = new DataView(datasetvar.Tables["Table1"]); The only reason I've had to use DataViews is for binding purposes, where I need multiple views into one table (for sorting or filtering). I've never needed to keep the DataView around in a collection, but maybe you do. I recently (a few months ago) went back and changed a LOT of code to use the Select method on a DataTable instead of DataViews. I did this in places where I needed to get a value from my DataSet, or a row, but I didn't really need to keep the values around for very long. For example, if I have a table "Cust" and I need to pull out FirstName and LastName, I could use a DataView or the Select method (which returns a DataRow array). The Select is about twice as fast, and has ALL the same functionality of the DataView (sorting, filtering, selecting from certain DataRowViewStates): string firstName; string lastName; DataView dv = new DataView(ds.Tables["Cust"], "CustID = 7"); if(dv.Count > 0) { firstName = dv[0]["FirstName"].ToString(); lastName = dv[0]["LastName"].ToString(); } DataRow dr = ds.Tables["Cust"].Select("CustID = 7"); if(dr.Length > 0) { firstName = dr[0]["FirstName"].ToString(); lastName = dr[0]["LastName"].ToString(); } -Nerseus
-
Why can't the webserver just communicate directly with the SQL Server? Creating a Web Service would be useful if there were a win32 application that needed access to the data or two or more applications (or various other reasons). Even if the web server and the SQL Server are on different domains, you can still connect the two together. I would definitely NOT run SQL Server and a Web Server on the same machine. Both want to take up a lot of memory and need to handle mutliple requests at the same time. A "fast" P4 server is only $3000 or so now, hopefully a client could swing that if they need an additional web server in addition to a SQL Server. -Nerseus
-
Here's a good mouse detect on resize ? for everyone...
Nerseus replied to UCM's topic in Windows Forms
I'm still not seing why you can't use the Anchor property. I have a test form that creates a label at runtime and places it on the docked panel control. I set the Anchor property of the label and when I resize my form, I see the label resize automatically. If you really need to trap the end of the resize, you might look into overriding or hooking the WndProc of your form and checking for Mouse_Up or NC_Mouse_Up or something like that (I'm not real proficient in the API). The NC_... is non-client and gives you messages like clicking the title bar and might give you whether the form's border is selected.... just a guess. But with .NET's new Anchor property, I'd try and take advantage of that before you invest too much time in custom resizing code. -nerseus -
With the code you've shown, I think the Error icon is always going to show. The only that would change is the icon's tooltip text, from Error1 to Error2. To clear the icon, you have to pass an empty string to SetError, as in: ErrorProvider1.SetError(mytxtBox, String.Empty) -Nerseus
-
You might try wrapping the abstract declaration with "#if !DEBUG" and use "#else" for the non-abstract version. This way, in DEBUG mode you can use the designer because your form is not abstract, and when you compile in Release it is. You may need to change it to abstract while in Debug mode for some extra testing (since making it abstract may cause problems if you didn't code it right). Here's some C# code - I don't know the VB.NET syntax for "#if DEBUG" or which keywords make the declaration abstract (hopefully someone can translate this): #if !DEBUG public abstract class Form1 : System.Windows.Forms.Form #else public class Form1 : System.Windows.Forms.Form #endif -Nerseus
-
Have you tried opening any of the samples provided with the SDK? Have you tried creating a project from the DX9 template (click VB projects, then DX9 Visual Basic Wizard)? -Nerseus
-
Maybe the right mouse button could zoom in to show real 3d maps (from Earthviewer or terraserver, for example). The control would cost you about $1000 per user for licensing, but would look *great* - and no trouble finding Vatican City. Heck, find a top-down satellite view of the pope himself! (Just click on his big white hat to select that country) :) -Nerseus
-
Here's a good mouse detect on resize ? for everyone...
Nerseus replied to UCM's topic in Windows Forms
How about using the Anchor property of the controls to have them resize automatically? -nerseus -
I think Azrael could have used this information about a month ago :) Here's the other thread -nerseus
-
how can i check if my dataset is empty?
Nerseus replied to yaniv's topic in Database / XML / Reporting
You can check the DataTable's Rows.Length (or is it Count?) property. Assume you have a table in your dataset named "Table1": if(ds.Tables["Table1"].Rows.Length > 0) { // You have data } else { // You have no data } -Nerseus -
I can't duplicate this. I can see the Text property regardless of the Visible property, bound or unbound. I'm using C# but I can't imagine it works different in VB.NET. -Nerseus
-
I'd check your code - sounds like you're doing something that's changing the index. If it's bound, it may be the data that it's bound to. Normally, when you use bound controls you *never* change the control properties - you change the dataset. To deselect something in your combobox, you'd set the corresponding value in your dataset to System.DBNull.Value (or 0, or whatever indicates a bad/unknown value for you). -ners
-
How to user multiple Params with stored procedure..?
Nerseus replied to melegant's topic in Database / XML / Reporting
Have you walked through this code? I don't see how your loop is working, or at least not how you expect it to. You have "num" used as the loop and as the Max value. Try using something like: Dim i as Int32 For i = 0 To num ... Next Then inside your loop, change all the references to "num" with "i" since it is now your loop counter. -Nerseus -
Making main menu's menu boxes pop down programatically
Nerseus replied to aewarnick's topic in Windows Forms
We have the same type of program here, but it still seems easier to provide a Log Out/Log In type of function (if you don't want them to have to close/open the program) than to try and ask for a user/pass on every menu click. -Nerseus -
Visual Basic .NET book (with examples of multi-user access database)
Nerseus replied to ashrobo's topic in Water Cooler
I'd go with a "teach yourself..." guide if you're new to programming in general - they will teach you the IDE and the *very* basics of "programming". It would probably be helpful to find a book geared towards actual coding uisng whatever language you want. The books are usually split between how to develop a windows interface (a LOT on using controls, their events and such) and how to program (the structure of a language). I'm not sure of your level so I can't make any suggestions. If you're already a programmer/developer, I'd check out the Wrox books Robby listed. Wrox rocks, IMO. And of course, read this forum every day to keep the bugs away :) -Nerseus -
I do the same as divil. So: private string firstName; private string lastName; private int age; public string FirstName { get { return this.firstName; } } public string LastName { get { return this.lastName; } } public string Age { get { return this.age; } } This won't work in VB since it's case-insensitive (can't have a private firstName and a public FirstName). We also dropped all hungarian notation as the variable name is good enough about 90% of the time and the other 10% can be figured out at a glance. I despise the leading underscore, though I think it was relatively valid in C (not C++ or any other language for that matter). They even use two underscores for some reason though I could *never* quite see which vars had one and which had two underscores in the old IDEs. I worked with a guy many years ago in VB3 who used 1, 2 and 3 underscores at the end of variables to designate scope: 1 for a function, 2 for a form level and 3 for global (remember the keyword Global? :)). He eventually commited suicide. I wouldn't worry a WHOLE lot, wyrd, as long as you're consistent. Chances are that when you go to work somewhere, they'll already have a naming convention and you'll have to follow it. Or, in some cases, a client will dictate naming conventions (such as on a database, if they use a brand/version different than the one you're used to). -Nerseus
-
You can *sorta* use Enums interchangably with their base types (int for example), but you do have to Cast. At first, I was really bothered by this but now I don't mind. In fact, it's saved my behind a few times. Case in point, in VB6 you could interchangably use the enum or an Integer/Long. Unfortunately, that meant you had to manually check each value to ensure it was a proper Enum value before using it. I *hated* that - it usually meant creating two constants to define the upper/lower valid values for an Enum to keep the code "clean". While you have to cast an enum to an int now, I think it promotes much safer (or "strict") coding. The only downside I've seen is forgetting to cast the enum when assigning to a variable declared as object - you'll get no warning but it's probably not what you want to do. For example, we define all system-dependent lookup values as enums so that we can easily find them in code. When using one of these enums in a DataSet (where each column's value is type object), you can put in the Enum itself without casting. If you try and send that DataSet to a Webservice, you'll get an error because the Enum doesn't exist on the other end (the serializer is nice enough to put the Enum in the DataSet as itself, not as an integer value). Here's some old VB6 code, for those interested, that shows just how BAD Enums could be: Public Enum Testing a = 1 b = 2 c = 3 End Enum Private Sub Form_Load() Dim a As Testing a = Testing.b Debug.Print a a = 8 Debug.Print a Test c Test 19 End Sub Private Sub Test(TestVal As Testing) Dim enumVal As Testing enumVal = TestVal Debug.Print enumVal End Sub This prints: 2 8 3 19 Obviously, the 8 and the 19 should NEVER have been allowed to be assigned since the variables are explicitly defined to be of type Testing (the enum). Arggh.... shame on you, VB6. -Nerseus
-
Unfortunately, the help isn't much help for this one. I know that Wait and DoNotWait are the two most common and refer to whether the flip should happen immediately, or wait for all previous drawing to be complete (you can look at IDirectDrawSurface::Flip in the C++ documentation). The NoVSync is probably related to the monitor's vertical retrace. I say probably because DirectDraw is a bit older and they've since moved the VSync related params to somewhere else. Normally, you want to wait on the retrace to prevent "tearing", especially in 2D graphics where you're likely to have more straight lines and thus the tearing would be more apparent. A monitor draws with a beam of light from top left to bottom right. If you don't wait, your image may "tear" because the top half will draw from a different point of view than the bottom. If you do wait, you're locking yourself into a framerate no greater than the monitor's refresh rate (usually 60-100hz, so 60-100 fps, max). Since 30-60 FPS is ideal, locking into the monitor's refresh isn't as bad as it sounds. -nerseus
-
Making main menu's menu boxes pop down programatically
Nerseus replied to aewarnick's topic in Windows Forms
Are you saying that you prompt for a password every time the user clicks on your main menu item? Wouldn't it be MUCH simpler to prompt for a password at some other point (when starting up the main form, for instance). If they don't enter the right password, just don't show the app at all or hide all menus except for Exit or File->Exit. -Nerseus -
Start by downloading the DirectX9 SDK, from here. It contains numerous samples in C#, VB.NET and C++ on playing multiple WAV files. I'd strongly suggest downloading the main SDK, not the "Componentized" version. Some people have had issues with the trimmed down versions though I don't know if the problem was user-oriented or something MS did. -Nerseus
-
Does your project have more than one form? Is the data form with everything on it Form2? Check your project properties and see what the Startup is set to - I'd bet it's Form1 (or some form that's NOT your data form). If you have a Sub Main, you can also look in there for a line like Application.Run(...) and make sure that it's running your data form, not some other form. If you only have one form, let us know. There's a small bug that crops up from time to time in the IDE that erases a few lines of code that are relatively easy to put back (maybe) :) -nerseus
-
nevermind... Volte got it right. Me, not so much :) -nerseus
-
When you declare the DLL function, use a byte[] or char[]. Either can easily be turned into a String in .NET. -Nerseus
-
I'm no C/C++ guru either, but my guess is that you need to add the OBJ file somewhere in the project properties so that it gets linked in. Look at the make file and see where the OBJ file is being referenced and hopefully it will give some clues as to where you need to put it in the project properties. By the way, I thought fork (and maybe multi-thread fork) were unix commands for starting a new thread. Is the OBJ file he gave you compatable with windows? You may want to cbeck on that, too. -Nerseus
-
Just a guess since no one else is answering... Did you look at the IL? I wonder if it performed the GetCurrentHash.Item(interfaceName) one time outside of the loop and used that type in the CreateInstance call? Also, did you time this multiple times to make sure it wasn't a fluke? I've never used the CreateInstance method, so I have no idea what it's doing versus a New. -Nerseus