Nerseus
*Experts*-
Posts
2607 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Nerseus
-
I can make a few comments based on how I've done things... just opinions and it may make more sense to go a different route for you - who knows? :) Question 1: Using any types other than base types (int, string, etc.) is difficult if your clients need to communicate with your web services but can't understand the .NET types. Passing an ArrayList is probably not a good idea, for instance. In that respect, parameters to webservices that clients will use should probably be generic. Speed and more network traffic (for bulkier XML) is a tradeoff for having more options with clients. If your clients can all agree to use .NET, then you could obviously open things up a bit. It's sort of the same argument you have when deciding if your Web based apps should target IE or any browser. We've mostly decided to use basic types (ints and strings) for simple methods and anything more complex requires XML that must be validated server-side. Once you get the basics of schema validation down, it's not so bad. Question 2: Again, what you want to return depends on your needs. I have one project that needs to return info to multiple clients which might be a browser, a VB6 app using SOAP and other clients who use WebSphere (I don't know why... tsk tsk tsk). Pretty much the ONLY route to go was to use XML since any operating system/language can make an XML string. Speed has not been an issue that we've noticed. On another project, however, we use pretty much whatever we want (within the confines of what's serializable for WebServices). Besides base types, we use DataSets (to and from) and Hashtables (mostly to pass params). As a side note, our webservices are nothing more than simple pass-throughs for the most part. The real code lives in a separate class file. This has helped us numerous times when we need to use a class from more than one web service or when we need to return a DataSet as a DataSet and as XML (the project uses about 90% WinForms code and 10% web based code). It's easy to create one method that returns ds and another that returns ds.GetXml(). -Nerseus
-
I'm no Java pro, but I believe Java supports multiple inheritence...? I know C++ does. C#, VB.NET, etc - all Managed Code languages in fact - do not currently support multiple inheritence though MS does have plans to add that later. In just about every other way, C# and VB.NET are "superior" languages over Java in terms of supported features including the ability to by "ByRef" type arguements - something I can't believe Java doesn't support. I think everything else has been covered :) -Nerseus
-
This has been covered a few times - maybe we should add it to a FAQ (when we get one). Check out your InitializeComponent function. Look at the VERY bottom where it sets properties for the form. It's probably missing the line: this.Controls.AddRange(...) If it is, it's probably missing a bunch of other lines as well. Sometimes .NET (maybe with SourceSafe, maybe not) just deletes those lines. I've seen it happen on a number of machines but never reproducable. Check source safe if you have it, otherwise you'll have to manually add the controls back to the form's collection. -Ner
-
Here's another method: System.Diagnostics.Process.Start("http://www.yahoo.com"); It will open in whatever your default browser is. -Nerseus
-
You can use the SubString method, as in: sFile.SubString(0, 1) -Ner
-
It shouldn't be any larger when it's not dropped down, but when dropped down it might overlay some other information. It's still better than the technique I used in VB3 where we made the whole control wider while dropped down, then shrink when closed - very nasty looking :) -Nerseus
-
If you know the names of your TabPage or if you have a reference to that TabPage (as your first sample showed), you can also set the SelectedTab property. -Nerseus
-
You can set the ComboBox's DropDownWidth property, probably the closest thing you'll find. You'll probably want to compute the text length to find the maximum sized string. Here's a C# code sample that may work for you: comboBox1.Items.Add("hello world"); comboBox1.Items.Add("blah"); comboBox1.Items.Add("Show me a sane man and I will cure him for you"); Graphics g = comboBox1.CreateGraphics(); float maxSize = -1f; SizeF size = new SizeF(); foreach(object o in comboBox1.Items) { size = g.MeasureString(o.ToString(), comboBox1.Font); if(size.Width > maxSize) maxSize = size.Width; } g.Dispose(); comboBox1.DropDownWidth = (int)maxSize; You could check the maxSize against the current control Width and only set the DropDownWidth if it's bigger - that way you don't get a tiny drop down portion... -Ner
-
I'm not sure what you mean by size limit... If you mean total size of variables declared in a subroutine, there is no 64k limit in VB6 or VB.NET (declare an array of bytes of size 100000 for instance). If you mean total size of code, compiled, I'm not sure I'd know how to check that. If you mean total number of lines of code, there is indeed a limit of about 64k. In VB6, I pasted in the following: Dim l as Long l = l + 1 ' Copied this line 65522 times!!! If I try pasting one more line of code, the VB6 IDE gives me an "Out of Memory" MsgBox - not while running, just while trying to paste the line of code. If you try to insert a few blank lines in the middle, the IDE just crashes... In VB.NET I get similar results, but they're not as consistent. Pasting in a ton of code sometimes gives me an error at design time (a MsgBox in the IDE). Other times I can run, but the results of the code are wrong. For instance, running "l = l + 1" 202,000 times gives me the answer "123,456.79" - obviously some kind of overflow bug. Running the same program a second time gives me a runtime error of "Common Language Runtime detected an invalid program.". Of course, all of this should never happen in "real life". A routine that large is horrible programming practice... -Nerseus
-
Are you using a DataReader by chance? I know that a ReadOnly, ForwardOnly style cursor (firehose method) keeps a connection open and might cause this error. If you're using a DataReader, try moving to the end or closing the reader first, then do your rollback. Just a guess... -Nerseus
-
lol, IT finally got it right...? :) -Nerseus
-
You need to change the loop to add the counters at the bottom since a For loop changes the value at the bottom (when it hits the Next statement). Also, you'll want to reset your intInnerCounter on every pass through the outer loop since the For statement does that as well. Here's a revised version that works, hopefully - I can't test it from here but I hope I did it right :) intTotal = 0 intOuterCounter = 2 Do While (intOuterCounter >= 2 And intOuterCounter <= 5) intInnerCounter = 2 Do While (intInnerCounter >= 2 And intInnerCounter <= 4) intTotal += intInnerCounter intInnerCounter += 1 Loop intOuterCounter += 2 Loop -Nerseus
-
Again, what does your connection string look like? :) -Nerseus
-
What does your connection string look like? Do you have the database open in Access while testing your website? Access usually holds locks that prevent a normal connection from being made (I think the message is something about exclusive access to the database). Make sure you don't have the database open anywhere, then try again. -Nerseus
-
Are you both using 16bit or 32bit color, or is the other machine running only 256 colors or less? A value with 8 hex digits is fine, by the way. The first pair represents the alpha component, usually FF (255 - or pure white, opaque). If you chop off the first two hex digits the remaining 6 make up the red, green, and blue. If someone is running fewer than 16bit color, a dithering may be applied which means you may not get the exact same color on other machines. Standard colors, including standard Web colors, have a better chance of working but anything but the base 16 colors have no guarantee to work exactly. I can see no reason why the values would otherwise show up differently on one machine versus another. Have you verified that the colors being read in by the other machine is the same value as the one on your machine? -Nerseus
-
The easies things to change are the server name (in your Modulo.ServerName variable/property/whatever) and add a UserID/Password. Make your connection string look something like this: Private ConnectionString As String = "Database=" & Modulo.DatabaseName & _ ";Server=" & Modulo.ServerName & ";Connect Timeout=5;uid=" & ModuloUserName & ";pwd=" & Modulo.Password In the end, it should look something like this: Database=DBName;Server=yourserver;Connect Timeout=5;uid=sa;pwd=test -Nerseus
-
What's the error that you're getting? Is it related to the ArtistID you mentioned? Also, did you design the Database or someone else? -Nerseus
-
VB.net and SQL DataSet fill. HELP!!
Nerseus replied to chicago75's topic in Database / XML / Reporting
You didn't show us where you set the SQL command for the SqlDataAdapter1 object... Your SQLCmd object has a SQL command, but you're not using it in this code... Is that your problem, or just a cut-n-paste mistake? -Nerseus -
Why not use the ToString method, as quwiltw suggested? You can use it like this: Dim ValueOutDecimalPart As Double ValueOutDecimalPart = 123456.789 Debug.WriteLine(ValueOutDecimalPart.ToString("n")) 'Displays "123,456.79" There are other options on the ToString method - check out the help for more info. -Nerseus
-
help with dataset current position....
Nerseus replied to hemenkap's topic in Database / XML / Reporting
You have two options. Loop through the DataSet one row at a time (using a "for i =..." type of loop) and compare the value manually. When (and if) a match is found, you have your row number. The other method uses a DataView. You can use the DataView's Find method (similar to Select) but returns a row index. -Nerseus -
I'm sorry I don't have .NET on my current machine (I'll test tomorrow), but I'll try to offer a few general items. First, does this happen with any other applications, such running the mouse back and forth over the menus of Word, Excel, Outlook, IE, etc.? I had this happen once about 5 years ago and it turned out to be bad memory (though all memory "checker" programs reported it as Ok). Also, do you have any other developer machines you can try this on (besides us in the forum)? Especially if it's the same type of machine (like a coworker that has the same model of computer as you). If not that, does it do with a more standard window and menus? Have you tried a single non-MDI form with a set of menu items that stays static - essentially no code on your part. I apologize if that's what your sample is - I'm too lazy to look at the code in Notepad right now :) I've never seen the problem you're describing and I do have an MDI application that has menus built dynamically at runtime and change over the course of the application. I don't use standard menus though, but a 3rd party control. I've not seen the problem you're describing though. -Nerseus
-
get RAISERROR from SQL Stored Procedure
Nerseus replied to basesuck's topic in Database / XML / Reporting
Sounds like a good candidate for a static method to me (unless you plan on calling more than on method on your Fehler class). :) -Nerseus -
To be clearer (in case you didn't know what divil meant), could you make your class a struct instead? Then using asignment would make an actual copy instead of just assigning the pointer to the same instance. Also, passing a struct ByRef would pass a copy of the object rather than just a reference. -Nerseus
-
You need to create a new instance of your class type (whatever it is), and set all properties of the new class to the current instance (Me). Return the new instance in the Clone function. If all of your private fields are value types, you can use Me.Clone() instead. If you have ANY fields that are objects, you'll have to do it manually. -Nerseus
-
More importantly, it does BOX pasting :) -Nerseus