
Bucky
*Experts*
-
Posts
803 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by Bucky
-
Here's something that works, assuming you take out all the parts after the "TPD#". This is not really the proper way to do this... you should be using regular expressions. I tried to do that, but I couldn't figure it out at the moment. To solve your problem, you need to treat your string more generally; don't hard-code what each "label" is (name, DOB, etc.). Instead, just look for words that end in ":" and break lines up according to that. Dim values As String values = "Name: Lanton Lamho Race: White Sex: Male Age: 18 DOB: 05-10-90 Height: 5�06 Weight: 152 Hair: Blk Eyes: Brown" Dim words As String() = values.Split(New Char() {" "c}) ' Split input string into words Dim lastLabel As Integer = -1 ' Keep track of the previous label's location in the array Dim output As String = "" For i As Integer = 0 To words.Length - 1 Dim word As String = words(i) If word.EndsWith(":") Then ' If we have a label (ends with ":") ... If lastLabel <> -1 Then ' ... and we know where the last label was... For j As Integer = lastLabel To i - 1 ' ... then concatenate all the words between the labels output &= words(j) & " " Next output &= Environment.NewLine End If lastLabel = i ' Bump up the location of the label End If Next ' Your string will be in the variable output Hope this helps.
-
I was experimenting with running applications on a USB thumb drive today and figured, on a whim, that I'd try installing SharpDevelop directly to the drive to see what happened. I figured that it would crash and burn, especially running on a computer that didn't have the .NET Framework SDK installed. How wrong I was! From the short experiments I did, it seemed to run PERFECTLY on a computer that has never seen the .NET Framework SDK before. I'm sure the .NET Framework Redistributable is required, but most XP machines have that anyway, and you can always carry the installer for that along just in case. I've always wanted something that I could have with me to do programming with anywhere. This seems like a great solution. I'd love to hear feedback to see if it worked as well for anybody else.
-
If the moderators feel that a leader or moderator is inactive indifinitely, then they can remove just the status. This happened to me at the VB Forums... now I'm a "Retired Leader" there since I've moved to .NET programming, but this doesn't mean I won't re-visit the VB Forums occasionally.
-
It's simple to open a file with its default application (as if you double-clicked on it): System.Diagnostics.Process.Start("c:\app\details.xls");
-
This download on MSDN contains an example of a chat application in VB.NET and in C#. After you download and extract the .msi, the folder is called "Advanced .NET Framework (Networking) - Use Sockets."
-
Actually, String.Split() does accept multiple delimeters; they must be of the char datatype. So, for example, if you wanted to split by spaces and by periods: string sentence = " This is a $5 million cost reduction program. The company has about 2.6 million distinct inventory items."; string[] words = sentence.Split(new char[] {' ','.'}); I agree, however, that this is not a good idea because of the 2.6 figure. Instead, I would split only by spaces and then go through each word and remove trailing periods.
-
Osamah, place the "Dim x As New Form2()" outside of your command_click function. That way you will only ever have one instance of the form created at once. x.Show() should still remain in command_click.
-
It most absolutely will! If I understand correctly, the .NET Framework 2.0 will be integrated directly into the OS. With the new command-line shell you'll even be able to execute .NET code right in the command line (unless they removed that feature as a security risk... I've heard conflicting reports). Consequently, .NET code should be running faster, and deployment will become much less of an issue.
-
Hey all! It looks like this forum has 1/10 of a million posts on it. Coolness. Thought you all might want to know. Sorry, I don't have any party hats to give out.
-
As far as JavaScript is concerned, after the ASP.NET server renders the web page, the controls actually become standard HTML input controls. Since JavaScript is run on the client side, and the only thing the client receives are HTML controls, this code will work.
-
You could use ControlChars.Tab, but the ControlChars class is VB-specific and I wouldn't reccomend it. You can also use Convert.ToChar(9), since 9 is the Unicode value for a tab character.
-
The tag you're looking for is <iframe>
-
There's more than one way to skin a cat! string connString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]
-
I would go for a handy combination of a Text field, a Select field, and some JavaScript. Every time the user types in a value in the textbox, loop through each item in the Select field and see if it begins with what the user types in. If it does, select that item by setting the selectedIndex property of the select field. Oh, and as far as I know, AutoComplete is a client setting, and probably cannot be disabled for a specific page.
-
I'd reccomend scanning through some info about Javascript, but the property you're looking for can be found here. This will go inside your <head> tag. This simply makes a function ClearTextBox() that you can call from any <script> block following it. <script type="text/javascript"> function ClearTextbox() { myTextBox.value = ""; // Clear the textbox, where myTextBox is the name } </script> And here is an example of the textbox control you'd use, and the button which would clear it. <input type="text" name="myTextBox" /> <input type="button" value="Clear" onClick="javascript:ClearTextBox()" /> This is untested code, but you should not have any issues. It is pretty straightforward. Just remember to replace myTextBox with the actual name of the input field.
-
FYI, Xtreme .NET Talk is actually an offshoot of Xtreme VB Talk, and there are a lot of contributors that frequent both forums. I'm just saying this so some people aren't offended.
-
If you need to reference the ControlCollection in methods, I'd reccomend passing an instance of the ControlCollection directly via one of the method's parameters. Or is this not feasible for some reason?
-
Connecting to the COM Port in .NET
Bucky
replied to Khaledinho's topic in Directory / File IO / Registry
Also, straight from the source: http://www.microsoft.com/downloads/details.aspx?FamilyID=075318ca-e4f1-4846-912c-b4ed37a1578b&DisplayLang=en -
Actually, the error is occurring because you cannot compare a string and a double (or integer, or any other numeric data type). You could be comparing "moo" > 2500 or "1337" > 2500... obviously it won't work. This is where the static methods of the System.Convert class come into play: If GrandTotalUSDValue.Text.Trim().Length > 0 Then ' Check for a value first Try select case Convert.ToDouble(GrandTotalUSDValue.text) > 250000 ' Convert to double first case true 'GrandTotalUSDValue.cssclass="ColorUp" ' Other cases go here End Select Catch ex as InvalidCastException ' Catch any errors ' Display an error message End Try Else ' No value entered End If I'd also reccomend reading MSDN on Developing a Validator Control
-
That's not quite the problem I was having, though the solution will definitely come in handy in the future. The issue with my web service is that a SoapException is not even making it back to the client. Instead of returning a <fault> soap message, it returns an HTTP error.
-
For some reason, my ASP.NET web service will not correctly return exceptions to the client machine. The .NET Framework SDK says that a web service should return a SoapException whenever a server-side error occurs, and the client should see some sort of <fault> element. All the client sees, however, is a generic "HTTP 500 Internal server error". I even tried explicitly throwing a new SoapException, but with the same result. I'm thinking that there is a certain project property that is not set correctly, but I can't find it for the life of me. What do I need to do to allow the web service to return exceptions to the client? Thanks.
-
Instead of painting directly on the form, I would do the drawing to some Bitmap variable of the same dimensions of the form's region. After all the drawing on the Bitmap is completed, then paint the Bitmap itself on the form. In addition to reducing flicker, this will also enable you to easily use Clipboard.SetDataObject().
-
Thanks for your replies. Those extra parameters in the connection string were left over from when I copied the string from an OleDataAdapter that had been automatically generated. Anyway, the issue, now solved, was with the SQL statement. I've just learned that % is the SQL wildcard character, not *. Whoops.
-
Well since I'm not working with a DataGrid here, there isn't any DataMember property to set. Here's the SQL statement I'm working with, for reference: