Nerseus
*Experts*-
Posts
2607 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Nerseus
-
If this is mostly for you to learn DB stuff, I'd definitely stick with Access. It's *much* easier to setup, connect to, backup (copy a file!), etc. etc. The only real difference in .NET is in the providers - I think you can use the SqlClient objects for MSDE (though I'm not 100% sure), whereas Access will use the OleDbClient objects. The other objects (DataAdapter, DataSet, DataReader, etc.) are the same since they're in System.Data, not specific to OleDb or Sql. The usual reason to choose MSDE in the "real world" is to more easily port any queries, tables, etc. into SQL Server if your app demands that level of database support. -Nerseus
-
I think you'd have to bind to the DataView to have the binding work on the view. It seems like you'd want all of your controls to bind to the DataView though, right? Meaning, you say you're binding all controls consistently, so why not bind them all to the DataView? I have used DataViews on tables to bind different controls to different views and it works pretty nice. Meaning, if you have the need to bind some controls directly to the table and some to a filtered view of the table, you can bind both ways. But maybe I'm misunderstanding what you're trying to do. :) -Nerseus
-
You guys are mostly right - assuming you are using positive numbers. Floor behaves differently for negative numbers. If you do Math.Floor(-1.88) you'll get 2 (weird, but true). To do that properly using the math functions, you need to check for < 0 and use Math.Ceiling. Casting as (int) works in both cases. -Ner
-
You might also want to try the asynchronous versions of the WebService. They should be built automatically and are usually called BeginWebServiceName and EndWebServiceName. -Ner
-
What is the best language for game programing ?
Nerseus replied to Matin_Habibi's topic in Graphics and Multimedia
I won't argue about the "best" language to use - it's pointless. Instead, since you're obviously new to programming I'd suggest either C# or VB.NET as the best language for you. They're much easier to pick up than C++ (managed or not) and you don't have to start with DirectX, which is difficult by itself even if you're really good at programming (regardless of language). I'd play around with pictureboxes and learn the language first, then move onto some GDI+ functions (for painting 2d pictures around the screen). Then move onto 3D if it suits you - this will probably be a few weeks/months depending on your investment in time and patience. -Nerseus -
You'll need a reference to the MDIParent form inside the module. I'm not sure of your code, but maybe you could pass the instance of the MDI form to the function in your module? Once you have it, just set the child form's MdiParent property to the instance of the MDI form. -Ner
-
Which implementation are you using? this FAQ mentions 4 versions and all work differently. Maybe you could post the code you're using for the ComboBox control and for a sample form so that we can help. And, are you just trying to set the DropDownStyle to DropDownList so that they can't type, or are you trying to JUST use the combo to always be read-only so that you can bind to a foreign key relationship (bind to ID in one table, show a description from another)? -Ner
-
Your code should be working fine. Try finding the currently edited row and calling EndEdit on it, to make sure that the row the user is currently on is updated in the DataSet (a requirement for HasChanges to report it). If you don't know how to get the currently edited row you can loop through all rows of all tables and call EndEdit on every row. If your table is named "Table1", try something like this: Dim row As DataRow For Each row In MyDataSet.Tables("Table1").Rows row.EndEdit() Next If MyDataSet.HasChanges() Then '... End If -Nerseus
-
In C# you just cast as an int, and it never rounds. Try: decimal i = 1.88M; Debug.WriteLine((int)i); I don't know the equivalent in VB.NET, if you need it just ask. -nerseus
-
What sign? Well question 2 is this: You could have said "I think it's System.Data.SqlClient or maybe it's SqlClient - I get confused on namespaces". But just blindly typing the questions and asking for the answers... well, as divil said: nil points for research! -Ner
-
Out of curiosity, I created a small test program. The results were somewhat expected (Regular Expression matching is slower), but there are a number of factors to consider. First, Regular Expressions are VERY powerful. Besides doing matching, they can do validation. Also, you can create very powerful expressions much easier than you could with IndexOf and Substring. I'll make two notes about the sample code. First, I wrote the regular expression code in about 5 minutes. Writing the IndexOf and Substring took about 15 minutes. Also, my first regular expression is MUCH more robust than the IndexOf/Substring method. For instance, the expression will automatically trim off any spaces or whitespace along with weird characters. Also, the code for regular expressions is MUCH more readable since each match is named. To get the last name, I simply use: lastName = match.Groups["LastName"].Value; Using IndexOf, I had to use: = 2; 2 = smallData.IndexOf(' ', +1); lastName = smallData.Substring( +1, 2 - - 1); Without comments, it's hard to say what's going on. Which code would you rather look at a year from now? Having said that, the speed is really dependent on what you need to do. If you need to parse through a 4 gig text file, I'd go with the fastest method possible and hard-code as many settings as possible. If you're parsing a string or two, I'd go with whatever is easier to maintain as both Regular Expressions and IndexOf are going to be perceptibly the same to the user. Here are the results after running the project in Debug mode in the IDE on my machine: short Data RegEx: 828 large Data RegEx: 2578 short Data Substring: 31 large Data Substring: 94 Press ENTER to close Keep in mind this is for 100,000 iterations. For 1000 iterations, all 4 tests come in at 0ms on my machine. -Nerseus regextest.zip
-
Well, you could mark the function as public so that another form could see the function. Remember that events are really just functions that are hooked up to get called automatically by windows. But you can still change the "private" word to "public". If it were me, I'd put the code that's currently in your activate event into a separate function. I'd then have the activate event call this function. This function could be marked as public and this function is the one I'd call from the other form. It strikes me as odd that the code you want to run when the form is activated needs to be run from another form... Regardless of how you declare the function, you're going to also need a reference to the form. I'm not sure of how things are setup, but that might be an issue if you're trying to use the class name as the reference (as you could do in VB6). If that's the case, just ask and we can answer. -nerseus
-
You couldn't answer ANY of these questions yourself? Did you read the chapter first? These should all be pretty easy if you read the book, I would assume. If you gave me any sign that you'd at least tried answering these, then maybe I'd be willing to help. -nerseus
-
Are you using Direct3D or DirectDraw? If you're using DirectDraw, the Draw and DrawFast methods on the surface objects take a number of overloads that specify source and destination rectangles or points, or just ints (if I remember right). If you're using Direct3D and you're using the sprite class, you can do pretty much the same thing. If you're using Direct3D and you're NOT using the sprite class, you'll have to calculate the texture coordinates yourself. -Nerseus
-
There's an AudioVideoPlayback namespace (you must reference Microsoft.DirectX.AudioVideoPlayback) - but I hear it only does basic audio and video playback, not the full DirectShow library. From the MS newsgroups, it sounds like there is no managed support right now for DirectShow. There's a thread titled "No DirectShow What a Surprise!" where people have talked about the basics of creating a managed wrapper around the non-managed directshow pieces - it didn't look that difficult, but I didn't read it that close :) -Nerseus
-
Do you really want to Activate the other form, or just run the code in that event? -Nerseus
-
I can't comment directly on any books in particular, but I can mention this. VC++ books come in two flavors: those that deal with the visual parts of VC such as adding controls and changing properties and using MFC, and those that deal with the language = C++. Most of the books with "VC++" in the title will focus on the IDE and control-oriented portion while books on C++ will focus on the language. Since both VC++ and C++ have been around for quite a long time, I'd suggest going to your local library where you can find FREE books on VC++ and C++ the language. Also, used book stores carry a plethora of books on both subjects. At used prices, you can often get two or three books for the price of one. One last comment - if you want to buy online (after you've perused the books first-hand), I'd suggest looking at http://www.bookpool.com. They seem to have the cheapest computer books around. -Ner
-
Check out this link. Attached is a zip containing the file I use - it's generic enough to use on ANY .NET executable. For development, make sure this file is in the same directory as your EXE file and named the same as your exe but with a manifest extension. So if your exe is named "WinTest.EXE" name the manifest file "WinTest.EXE.manifest". -Nerseus PS: Here's the contents of the txt file: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <description></description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly> yourapp.exe.zip
-
Working With Null Values from the DB
Nerseus replied to MarkItZero's topic in Database / XML / Reporting
Like all the other ones, hemenkap, this won't work in VB.NET. The IIF will evaluate all expressions regardless of whether the expression is True or False. I believe this is mentioned at least twice in this thread alone. But, if you want to try it yourself, paste your code into a test app and let us know how it works. -Nerseus -
Don't forget his Christmas card come December :) -ner
-
There are lots of web server products, but sending an email definitely requires more than just a simple DLL and an internet connection. Now if you want to launch the default mail client, such as Outlook or Outlook Express (or whatever the user has defined to be the default mail client), then that's a bit easier. But if you want to create an email and send it, it's a bit harder. The basic reason is to prevent any old person from creating 10,000 emails to spam whoever they want. By installing a server, the IP address will get put in the header along with a bunch of other information. Search google for SMTP server and I'm sure you can find some cheap, maybe even free, mail server software if that's what you want. But you're out of luck trying to create a program for end-users to install that will send email automatically. -Nerseus
-
Don't include the object folder either - it gets created when you compile the project. -Ner
-
Multiple Forms - How to close the Entire program?
Nerseus replied to Disasterpiece's topic in Windows Forms
Don't hide the Login window, you have to use Close. Maybe that's the problem? -Nerseus -
Ah, well what do you want to do with lines that don't have a space? Do you need them in your array for something else or can you exclude them? If you want to exclude them, simply change the line in my original Loop to use IndexOf(" ") > 0. Otherwise, why not just do the IndexOf check before trying to use it in the substring? Public Function GetValue(ByVal keyGet As String) As String 'Given key name keyGet, return corresponding value string Dim i As Integer Dim keyFound As Boolean Dim keyDesc As Boolean Dim keyStr As String Dim keyStr2 As String keyFound = False keyDesc = False For i = 0 To Open2.Length - 1 If Not (keyDesc) Then If Open2(i).IndexOf(" ") > 0 Then keyStr = Open2(i).Substring(0, Open2(i).IndexOf(" ") ) If keyStr.Equals(keyGet) Then keyFound = True If keyStr.Equals("description") Then keyDesc = (Open2(i).IndexOf("""") > -1) And (Open2(i).IndexOf("""") = Open2(i).LastIndexOf("""")) End If If keyStr.Equals("licence") Then keyDesc = (Open2(i).IndexOf("""") > -1) And (Open2(i).IndexOf("""") = Open2(i).LastIndexOf("""")) End If If keyFound Then GetValue = Open2(i).Substring(Open2(i).IndexOf(" ") + 1) End If End If Else keyDesc = (Open2(i).IndexOf("""") < 0) If keyFound Then GetValue &= Chr(13) & Chr(10) & Open2(i) ' 13 = carriage return 10 = line feed End If End If If keyFound And Not (keyDesc) Then Exit For Next i If Not (keyFound) Then GetValue = String.Empty End Function -Ner
-
Can you just put a Label in the PictureBox? -Ne