|
Using the serial port instance on your Form1 instance from Form2 is bad practice. You also can't do it with the code you're written since Form2 has no idea that Form1 even exists.
If the bulk of your serial port communication is going to happen from Form2, create the port and connection on Form2, not Form1.
Also, if you dragged the SerialPort from the ToolBox onto your form, you can't use it from a second thread. The event's won't fire correctly because they depend on the main UI thread to work.
|
|
|
|
|
Hi!
i have made a component control and its inherited from System.Windows.Forms.Button class. now when i go to the designer and set the text property, i am unable to set the text property. when i set the text property and use this control on the form, that text setting is not coming. please let me know how can i get this resolution.
Thanks!
|
|
|
|
|
Without seeing your code, it's impossible to say what you did wrong.
|
|
|
|
|
i did not code anything. i have just created a component class and then went to designer partial class code and inherits it from the button class. that's it and then went to designer and tried to set the property from the property window.
|
|
|
|
|
How about this. Scrap the component you have and just add a new Class file to the project. Open that file up and replace anything you see in it with this:
Public Class MyButton
Inherits System.Windows.Forms.Button
End Class
Compile that, then drag one of these from the ToolBox to your form, then try and set the Text property.
|
|
|
|
|
hm that the way i have done too. the name of the control was "ASKButton" i have set the text property to "Add" then compile the project and drag drop the button control on the form and what i see is that the button text property is "ASkButton1". i want to set the default value for this button. when ever i drag and drop this button it should show me the Text=Add and when i want to change it, it should allow me to do so!
|
|
|
|
|
|
This has been covered all over the web countless times. All you have to do is Google a bit.
Google for "vb.net save image sql server", or whatever database engine you're using...
|
|
|
|
|
i have a string abcd 36.2 How to get the value 36.2 only , with abcd can be changed?
|
|
|
|
|
Hi
one option is that you can loop through the entire string and check for numerics
ie.
Dim x As String = "abcd 36.2"
Dim value As String = ""
For lp As Integer = 0 To x.Length - 1
If IsNumeric(x.Chars(lp)) Or x.Chars(lp) = "." Then
value &= x.Chars(lp)
End If
Application.DoEvents()
Next
MsgBox(value)
hope this helps
Anoop
|
|
|
|
|
That's the hard, slow, and non-globalized way to do it...
|
|
|
|
|
thanks
i have run time error 424 Object required .How do i solve it ?
Thanks\
|
|
|
|
|
There's always a space separating the text and the number? You could split it up on the space;
Dim MyString() As String = "Test 123".Split(' ');
You can get the integer-part like this;
Dim MyNum As Integer = Int32.Parse(MyString(1))
I are troll
|
|
|
|
|
Is the format always going to be 'AAAA ##.##'? Meaning is the value always going to be 4 letters followed by a space?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
No, lenghth of the string in front are variable . My purpose to get the number inside?
|
|
|
|
|
Hi,
split the problem in a couple of smaller ones. There are at least two parts:
1. locate the "word" that contains the number
2. translate that word to a numeric value
1. depends on what you do know about the pattern in the string.
e.g. if the number is always at the end, find the last space, get the substring behind it.
if there is exactly one word plus a space in front, find that first space and look for a possible space after the number too.
2. is easy with int.Parse or int.TryParse
If you were really lazy (I wouldn't dare to assume that), split the entire string in words based on a space, then foreach "word" do a TryParse until one succeeds.
And now you are on your own I guess.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi dec82;
you could use a regular expression to pull the numeric data out.
' Test data
Dim testData As String = "abcd 36.2"
' String to hold the wanted info
Dim numericValue As String = String.Empty
' A regular Expression to pull out the needed info
Dim m As Match = Regex.Match(testData, "^.*?(\d+(?:\.\d+)?)")
' Test to see if the string had a numeric value on the end of it
If m.Success Then
' Pull out the information
numericValue = m.Groups(1).Value
End If
MessageBox.Show("Numeric Value = " & numericValue)
Fernando
|
|
|
|
|
Hi I'm working on a project that involves printing a datagridview and I don't know how to write a complete code for, it looks too complicated please somebody help it's urgent.
|
|
|
|
|
|
I have a Interbase database file and want to use in VB but I don't know to make connection to Database
have somebody to know make connection
|
|
|
|
|
The Wikipedia page says that it supports standard interfaces, so access it like you would any other database
|
|
|
|
|
Use an OleDb connection, and set the connectionString[^] accordingly.
Good luck
I are troll
|
|
|
|
|
what is "sibprovider" give me this error "The "sibprovider" provider is not registered on the local machine
|
|
|
|
|
It's the driver[^] that you use to talk to the database. There's also one available for ODBC, from EasySoft[^].
Enjoy
I are troll
|
|
|
|
|
I have developed an application using Visual Basic .NET 2008 which uses a MySQL Database. The connection string i use is something like
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
so actually the server is localhost, database name is customers(or watever!), and uid=root and pwd is ***** :P
so everything works fine...now this program is something which i need to run on other computers as well....so do i have to install mySQL server to each and every computer that i need to run this software? cant i get a single database like MS SQL Server ?? .mdf or .sdf??? Plz help me! and if possible please tell me or post a website which can help me deploy the database to another computer to use.
This is a project which i need to submit to my university so plz tell me what files i need to burn on to the CD that im submitting and any special instructions that i should include in the CD to run the project
Thanx loadz in advance
|
|
|
|