
Nerseus
*Experts*
-
Posts
2607 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Nerseus
-
If they're from the KnownColor enum, you can use Color.FromKnownColor© If the color you store isn't a known color (just some semi-random RGB values) you'll have to do it another way. -Nerseus
-
Well, we don't write programs for people here. We expect you to try and write the program. As you go along and run into specific problems, we love to help out! I would start by writing a few test apps. Try updating a database table (assuming you already have a table created). Make sure all that code works. Next try reading from the text file. Look at the various classes in System.IO - there are plenty to choose from. Getting to know them so you know which is best is half the fun of programming. Finally, you'll need to parse what you read. You could use simple substring and fixed offsets, or various methods to split the string based on a space, or maybe use Regular Expressions. If you want to try regular expressions, search these forums and the help files for examples. -ner
-
How much programming do you know? Do you know how to connect to the DB and save records? Do you know how to read text files? Do you know how to read in strings and possibly use regular expressions (or just Substring method calls)? -Nerseus
-
Or use the MonthNames array: for(int i=0; i<12; i++) Debug.WriteLine(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames[i]); You can also get the abbreviations using AbbreviatedMonthNames. -Nerseus
-
@Mehyar, did you even try to Google the word "sharpdevelop"? Try that first (it's the first hit - use the "I'm feeling lucky" button) :) -nerseus
-
Do you mean you have a text file that looks like: #232323 xxxxx xxxxx xxxxx xxxxx xxxxx xxxxxxx xxxxxxxxxxxxxxxx xxxxxxxx xxxx #233224 And you need to parse the numbers into individual fields and save them to the database? -nerseus
-
Try: decimal d = 1234567.44M; string s1 = d.ToString("f1"); // "1234567.4" string s2 = d.ToString("n1"); // "1,234,567.4" The ToString() is the important part. The "M" in the first line is just to signify this is a decimal number. The "f" in "f1" means format like a number with no commas and n number of digits (1 in this case). The "n" in "n1" is the same, but formats using commas (or whatever your local thousands separater is). If you need to do explicit rounding, use the Math.Round() function followed by a ToString. -nerseus
-
If you want the motherboard's speaker to beep (the one inside your case), use: Private Declare Function MessageBeep Lib "kernel32" (ByVal frequency As Int32, ByVal duration As Int32) As Int32 and call it with something like: Beep(3000, 250) The 250 is milliseconds (about a quarter second, the most I can stand of that tinny speaker) :) I think the Microsof.VisualBasic namespace contains a Beep function that uses that as well. -nerseus
-
Primary Key & Foreign Key Question
Nerseus
replied to irasmith's topic in Database / XML / Reporting
If Table2's Foreign Key is unique, then you have a one to one join between Table1 (with the Primary Key) and Table2 (or a one to zero depending on your needs). If you have a one to many (or one-to-zero-to-many) relationship then you would normally have a primary key in Table2. Technically, if Table2 never gets updated or deleted from you might not need it, but if you do update or delete then you need a way to locate one exact row. Now a Primary Key in Table2 doesn't necessarily have to be one field. A common solution is to use two fields: the first field is the foreign key and the second field is a sequence. The combination of the two fields in Table2 would make a unique key. Personally, I hate those - it just makes it harder to update and insert, especially when users get to see the Sequence. Pretty soon they want the sequence kept in sequence even as some records are deleted or moved around. I'd rather have Table2 have an identity column used for a Primary Key and have a separate field for the Sequence (if you even need a sequence). That's another story though :) -Nerseus -
Run the following file: c:\DXSDK\Bin\DXUtils\dbmon.exe Then start your project in Debug mode in Visual Studio. The command window opened by dbmon will display a ton of information, including more detailed error messages. My guess is that you're trying to make a picturebox an exclusive device and it can't be done. You can only use a form when going exclusive (fullscreen). -Nerseus
-
You can still lock the surface (not the texture). I don't recall if it locks the physical memory (I don't think so), or just copies it to system memory and then back (I think so) when you unlock. You now lock by using the Lock method of the Surface object. Get a surface from a Texture with GetSurfaceDesc or GetSurfaceLevel or GetSurfaceLevelDesc (can't recall which one right now). -nerseus
-
Is the DLL called using DllImport or through a .NET or COM reference? If it's using DllImport, I'd bet you could define the parameter in VB.NET as Int32 and pass your value - technically an unsigned and signed int are the same except how math is performed. And since you're passing a baud rate, which is well within the signed int's range, you shouldn't have any problems. -Nerseus
-
Cast from string "VelvetBoo" to type 'Double' is not valid
Nerseus
replied to cmaras's topic in Database / XML / Reporting
Yes, from what I've read on other threads, Access does support stored procedures but you have to create and edit them by hand. Meaning, you'd have to run a command like "CREATE PROCEDURE test1..." for Access to create it. AFAIK, there is no GUI front end to do this with Access itself. -Nerseus -
I meant the new and updated namespaces, and they are aplenty :) -Nerseus
-
Well, the language itself is pretty much the same - nothing you'd really have to worry TOO much about (namespaces probably being the biggest addition that comes to mind). When you talk about C++ in .NET, there are really two flavors: managed and unmanaged. If you go managed, you will end up using the .NET managed classes to do a lot of work, such as creating windows with an inherited Form class or using System.IO to do file handling. If you go with unmanaged C++, it will be much closer to the non-.NET C++ (like your version 5 of VS). You'll be using the API for all of that stuff. So, the question should really be how you plan to use VC++. If you plan on doing unmanaged code, then you can go ahead and learn C++ v5 without too many worries. If you decide to switch to .NET later, you'll be in the same boat as everyone else, learning pretty much a whole new way of doing things (often easier though it may not seem that way at first). -nerseus
-
RickTextBox is all one word (not necessarily case sensitive). If you searched for "rich" "textbox" it might not find any matches (at least not for the thread Robby showed). -Nerseus
-
I've used the XmlDataDocument class to get an XmlDocument from a DataSet (they're kept in sync). I don't know if it will work the other way around though. If it does (you'll have to check), you might be able to load the file using the XmlDocument's load() method to load the file directly and then link it to a DataSet. Again, no idea if that will work, but might be worth investigating. This assumes that loading an XmlDocument from a file is faster than loading a DataSet from the same file. If the file is extremely large, you're better of sticking with something else (threading for example, as you're trying now). -ner
-
Installing Components in Visual Basic.NET Resource Kit
Nerseus
replied to Klogg's topic in Water Cooler
XP Home does not come with IIS. I haven't checked if it will work, but MS used to have a "Personal Web Server" that acted like a mini-webserver. You might look into that. -nerseus -
I've had this happen a few times (definitely not every time). I think it was a confirmed bug by MS but I don't recall seeing a work-around. It doesn't happen very often to me and I can't say I've seen it happen since moving to .NET 2003 though and like you say, if you reorder the tabs with runtime code, you avoid the problem altogether. If it's really bothering you, try searching support.microsoft.com to see if they have any info. -nerseus
-
Designer erase my code in InitializeComponent!
Nerseus
replied to aewarnick's topic in Windows Forms
AFAIK, the designer won't preserve control arrays and probably never will. For control arrays, you'll have to manually create them in code. I've done similar things and put all the code in a function that I call immediately after InitializeComponent. You won't see the controls in the designer though. -Ner -
not a question for a beginner
Nerseus
replied to bri189a's topic in Interoperation / Office Integration
If you want to pass NULL to a function from C#, you should declare your function as taking a System.IntPtr and pass System.IntPtr.Zero. Here's a sample: [DllImport("advapi32.dll")] static extern int AdjustTokenPrivileges (int TokenHandle, int DisableAllPrivileges, TOKEN_PRIVILEGES NewState, int BufferLength, System.IntPtr PreviousState, int ReturnLength); //and later in a function: AdjustTokenPrivileges((int) nTknHWND, Convert.ToInt32(false), privledges, 0, System.IntPtr.Zero, 0); I didn't look at the rest of your function, but if it's right then passing the Zero IntPtr should work. You could also try declaring the 5th param as Int32 and passing 0 which is pretty much the equivalent of NULL though the IntPtr is the recommended method. -nerseus -
Other than [WebMethod], you normally won't encounter attributes in many beginner books/tutorials. Not that they're advanced features by any stretch, it's just that there's so much to learn about .NET that they often get overlooked. -ner
-
If VB.NET is like C#, you'll have to set each array inside the struct to a valid array, maybe something like this: Structure CardValueStructure Dim Value() As Integer Dim Scenario_ID() As Integer End Structure Shared CardValueArray(0) As CardValueStructure .... ReDim Preserve CardValueArray(2) [b]ReDim CardValueArray(1).Value(1)[/b] CardValueArray(1).Value(0) = 5 The change above shows a redim of the Value member of the struct. Your original code redim'd the CardValueArray variable, but each instance's Value and Scenario_ID members are still empty (undim'd) arrays. I hope my syntax is right, or that you can fix it if it's wrong :) -Ner
-
You might be able to handle the WndProc and look for the WM_MOVE message and cancel it. I haven't tried it, but it should work. I'm not sure WHY you'd ever want to prevent moving a full screen window but there ya go. -Ner
-
The attributes (also called decorations as in, "decorate the method EchoServer with the DebuggerStepThroughAttribute attribute") are extra info for the compiler. There are a bunch of them and you use them for a variety of reasons. For instance, "[WebMethod]" marks a method as a webservice so that the compiler can generate the proper code. You can add simple attributes like Description to describe a property: [Description("The Min value")] public int MinValue { // property code would go here... } Assuming the above were part of a user control, the "Description" attribute lets the Property window (in design time) show the description. If you have any attributes particular you have questions about, ask away :) -Nerseus