|
i have three text box and a command button.initially button enable is false.i want if user input the values in textbox.and no textbox is blank then button enable is automatically true. and if any textbox is blank then button enable gets automatically false.
please help
sumit
|
|
|
|
|
Hi Sumit,
I would suggest you to write the following code on the change event of each textbox.
BEGIN CODE
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If Len(Me.TextBox1.Text) = 0 Then
Me.Button1.Enabled = False
Else
Me.Button1.Enabled = True
End If
End Sub
END CODE
I hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
hiiii
thank you for the suggestion but your code work for only one textbox.i have three textboxes and have to do the same for three textbox and a command button.when a user enter text on any textbox it should check for other textbox also
|
|
|
|
|
Presumably the button is to save the data?
A couple of issues with your design.
is enabled bsed on the values in ALL the text boxes - you are testing only 1 at a time.
Try this.
btnSave stats disabled.
you have 1 event called SaveOn which is used for each textbox ontextchange event. Here is one I used
Private Sub SaveON(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUserID.TextChanged, txtEmail.TextChanged, txtPWD.TextChanged, txtUserID.TextChanged, txtUserName.TextChanged, txtUserNo.TextChanged, chkDisabled.CheckedChanged, chkPWDExpireFlag.CheckedChanged, dtePWDExpire.ValueChanged<br />
btnSave.Enabled = True<br />
End Sub
Note the Handles for the different objects and events
In the save event you disable the save button
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a loop for adding rows of value to DataGridView Control with fixed size. The scroll bar appeared after row number is more than what DataGridView can display. The question is:
How can I implement auto-scroll so that the bottom row always visible after adding new row?
|
|
|
|
|
Count your rows using:
<br />
dim rows as integer<br />
rows = DataGridView1.Rows.Count<br />
Then see how many rows are visible,
let say 10.
Then use:
<br />
DataGridView1.FirstDisplayedScrollingRowIndex = rows - 10<br />
Good Luck.
|
|
|
|
|
Hi, Scubapro:
Thank you very much!
|
|
|
|
|
Dim sqlConnection1 As New System.Data.SqlClient.SqlConnection("Data Source=MUSCRIBMPC\SQLEXPRESS;Initial Catalog=adp3SQL;Integrated Security=True")
Dim fname, lname As String
fname = TextBox2.Text
lname = textbox2.text
Dim cmd As New System.Data.SqlClient.SqlCommand
cmd.CommandType = System.Data.CommandType.Text
cmd.CommandText = "update compiledpts set firstname=fname, lastname=lname where contactid = 2"
cmd.Connection = sqlConnection1
sqlConnection1.Open()
cmd.ExecuteNonQuery()
sqlConnection1.Close()
contactid is the table ID, compiledpts is the name of the table. everything else works except the syntax in the commandtext. if firstname is = " anytext " it updates with that text but I cannot use fname and I cannot use more than one viriable. WHAT IS WRONG PLEASE?
|
|
|
|
|
The syntax would be....
"update compiledpts set firstname='" & fname & "', lastname='" & lname & "' where contactid = 2"
Tirtha
Do not go where the path may lead, go instead where there is no path and leave a trail.
Author: Ralph Waldo Emerson (1803-82), American writer, philosopher, poet, essayist
|
|
|
|
|
Thankyou so very much I can not thankyou enough. It worked perfectely. Infact I am now trying to expand the same to allow insert and delete. You have helped me immensely. Thankyou you are a very good person
|
|
|
|
|
|
how can a command button trigger a scanner???
thanks in advance
|
|
|
|
|
How I can using araay of buttons in vb.net?
|
|
|
|
|
try this
clickety[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
you cant make array of control in vb.net
|
|
|
|
|
I am using VB to update a detailsview I have a dropbox and a textbox
I do detailsview.rows.cells = dropbox.selectedvalue and
detailsview.rows(x).cells(1) = textbox.text. both these lines appear in my ok button. This works and the detailsview is changed. The problem is the database is not changed. How do I update the database with my new values? Thanks in advance
|
|
|
|
|
MUSIWA wrote: The problem is the database is not changed
Why would it have changed? You haven't posted any code which updates the database.
It won't happen by magic. You actually have to write code to do it. If you don't know how to update a database using VB.NET, I suggest you buy a book on ADO.NET and read up on the subject.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I thought I did I thought there was an update command that I can add to my button to move the data to the database. I guess I was wrong. I am sorry if I insulted your intelligence but I am trying to learn this. Nevertheless I still need some direction. I abadon that though and now I am using an execute command see below
Dim sqlConnection1 As New System.Data.SqlClient.SqlConnection("Data Source=MUSCRIBMPC\SQLEXPRESS;Initial Catalog=adp3SQL;Integrated Security=True")
Dim fname, lname As String
fname = TextBox2.Text
lname = textbox3.text
Dim cmd As New System.Data.SqlClient.SqlCommand
cmd.CommandType = System.Data.CommandType.Text
cmd.CommandText = "update compiledpts set firstname = fname, Lastname= lname where contactid = 2"
cmd.Connection = sqlConnection1
sqlConnection1.Open()
cmd.ExecuteNonQuery()
sqlConnection1.Close()
now this stament does not work even though when I debugg the value of the textboxes have the correct values. The connection string works too. My problem is the command text is not working. Can you help me know what is wrong with it. Thanks!
|
|
|
|
|
MUSIWA wrote: cmd.CommandText = "update compiledpts set firstname = fname, Lastname= lname where contactid = 2"
This won't work. You have to build up the command text string, concatenating the variable values with the literal text. This isn't considered a good approach though, as it leaves your code vulnerable to SQL injection attacks. Consider using a stored procedure and parameters instead.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
How would I detect if the mouse hasn't been moved/clicked and the keyboard hasn't been pressed? I was thinking for the keyboard...
(Under Form4 KeyDown)
If e.KeyCode.BrowserHome = False Then<br />
Me.tmr.Start()<br />
Else : Me.tmr.Stop()<br />
End If
(+Timer)
Static x As Integer<br />
x += 1<br />
If x = 5 Then<br />
Dim form2 As New Form2<br />
form2.Show()<br />
me.hide<br />
End If
modified on Thursday, January 24, 2008 11:35:10 AM
|
|
|
|
|
Bonjour tout le monde.
Hi all.
I developed an application that must be installed on several computer. What's annoyingis that when i modify this application, i have to go and change the .exe on every computer. After some searches on the net, i saw that it is possible to deploy VB6 executable by using Click once. I followed the instructions found on MSDN and i've created the deployment setup MyProgClickOnce.exe.
My problem is that the behaviour of the click once is not what i expected it to be.
So far, I copied the new "MyApplicationExe.exe" in a directory on my C drive, "C:\MyApplication\" with a DB within it.
Now, with the Click Once, a link in my start menu is created "MyProgClickOnce.exe". When i click on this link, the application is welll launched but the executable file (MyApplciationExe.exe) is not in the directory ("c:\MyApplication") then, the link to my DB doesn't work.
I'd like to know if it is possible to specify the directory where I want to install my "MyApplication.exe"??
Thanks in advance
Chris
Mia
|
|
|
|
|
Quick answer No!
Click once gives you no control where you are deploying your app to.
I think there are a number of issues with your information
VB6 - I'm not aware you can deploy VB6 via clickonce
your deployment folder should be a network share folder
If you are deploying the database with each client there will be multiple DBs in the wild. Should you not connecto to a single DB?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi
Yes, you can deploy VB6 application with click once. It works but I need to choose the place I want to install the Exe.
I don't deploy the Db with all clients, I put it on a server.
Thanks for your answer.
Mia
|
|
|
|
|
Hi Friends,
I want to know the LAN connection Status of the machines connected in the LAN.
I need a code in VB.NET 2003 WebApplication.
Kindly mention the namespaces and detail code to check the LAN connection Status.
Try to make a code easily understandable.
Thanks in Advance
|
|
|
|
|
take a look at
System.Net.Dns.GetHostName(); System.Net.IPHostEntry & System.Net.Dns.GetHostByName();
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|