how to bind combobox to textbox in VB.NET ComboBox and TextBox VB.NET Visual Basic How to show combo box selected value in a text box VB.
source
how to bind combobox to textbox in VB.NET ComboBox and TextBox VB.NET Visual Basic How to show combo box selected value in a text box VB.
source
26 responses to “MySQL VB.NET Tutorial 10 :Database values in textbox if select Combobox”
Sir how about displaying a value into a textbox that came from a text box…
example: texbox1 has a value of "2" and its value came from the selected row from the dataGridView that contains ID, Name, andPurchaseTotal, and the value that was displayed on that textbox1 will be displaying in another textbox…and the query is Select OldQuantities,OldUnitCost,OldTotal from tblPurchase where ItemID ='" + TextBox1.Text = +"'"
BTW They are on the same Table
Sorry for a long comment haha…TYIA
you can use this short cut if reader.getstring ("data") will have an error
Label3.Text = Reader("data")
Hi Sir, i have been following your videos for quite some time, basically some of my software i made i turn to your videos for reference most of the time. for this particular topic however i am having a problem since instead of using textboxes i transfer the output to labels like so:
Label1.Text = READER.GetString("DB_Name")
this works for a single row,, i am trying to grab the whole column with the rows that have the same data and display them in multiple labels.. any ideas on how to?,, thank you very much for a speedy reply
what should we use for auto complete combox event instead of selected_index_changed?
Please can you provide a download link. Its very hard trying to copy it out of a video
cannot convert from string to integer error i get when i store eid pls help
I would also like to know if it is possible show employee picture to the form from the picture path that is stored in the sql server table. Please share if anyone has ideas of achieving this
Great tutorial, I have learn a lot using same concept to listview to retrieve the user information to texts from sql server table
Is there a way that i can connect 2 tables using this? i mean 2 combobox with 2 different tables.
Love you
Very thx again for this perfect tutorial serial, but just small thing, the point with the user loginto password section drive me cracy.
was it neccesary? But thx lot.
how to apply this in asp.net vb? i ned this for my website but instead of combobox you apply dropdownlist
how to code this if we are using sqlserver2012 instead of MYSQL
thanks.. your videos help a lot! 🙂
Thank you so much! I have been working on my project alot and had some errors! But you helped me so much! :)))
How about from database values in combox to datagridview. Thanks Sir
You are my best programming tutor..thanks a lot
is this applicable with sqlclient?
can i do it for text changed in textbox instead of combobox
you are my best vb teacher, thanks !
Hi, i try this to take 2 values
While READER.Read
Dim Apellidos = READER.GetString("test1")
Dim Nombre = READER.GetString("test2")
ComboBox1.Items.Add(String.Format("{0} | {1}", test1, test2))
End While
But for the button what is the correct syntax ?????
Query = "select test3 from xCantera.test where test1='" & ComboBox1.Text & "'"
Thanks you…
im trying to run my code in sql but its keeps saying this message "Conversion from string to type Integer is not valid"
any advice, PLEASE HELP!!
MysqlConn = New SqlConnection MysqlConn.ConnectionString = "Data Source=SABAHALI-SHEIKH;Initial Catalog=md_1103763;Integrated Security=True" Dim READER As SqlDataReader
Try
MysqlConn.Open()
Dim Query As String
Query = "select * from md_1103763.dbo.customer"
COMMAND = New SqlCommand(Query, MysqlConn)
READER = COMMAND.ExecuteReader
While READER.Read
Dim fName = READER.GetString("firstname")
ComboBox1.Items.Add(fName)
End While
MysqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
Error
Conversion from string "name" to type "integer" is not valid
VS 2012
+ProgrammingKnowledge help me please
Source :
Imports MySql.Data.MySqlClient
Dim MySqlConn As MySqlConnection
Dim COMMAND As MySqlCommand
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MySqlConn = New MySqlConnection
MySqlConn.ConnectionString =
"server=localhost;userid=root;password=;database=vbnetmysql"
Dim READER As MySqlDataReader
Try
MySqlConn.Open()
Dim Query As String
Query = "Select * from vbnetmysql.edata "
COMMAND = New MySqlCommand(Query, MySqlConn)
READER = COMMAND.ExecuteReader
While READER.Read
Dim sName = READER.GetString("name")
ComboBox1.Items.Add(sName)
End While
MySqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MySqlConn.Dispose()
End Try
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
MySqlConn = New MySqlConnection
MySqlConn.ConnectionString =
"server=localhost;userid=root;password=;database=vbnetmysql"
Dim READER As MySqlDataReader
Try
MySqlConn.Open()
Dim Query As String
Query = "Select * from vbnetmysql.edata where name='" & ComboBox1.Text & "'"
COMMAND = New MySqlCommand(Query, MySqlConn)
READER = COMMAND.ExecuteReader
While READER.Read
txtEid.Text = READER.GetInt32("eid")
txtName.Text = READER.ToString("name")
txtSurname.Text = READER.ToString("surname")
txtAge.Text = READER.GetInt32("age")
End While
MySqlConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
MySqlConn.Dispose()
End Try
End Sub
Thank you for your videos!
It help me a lot and give me understand more!
thank you very much
this is very helpfull
at 8:33 you refer to an integer…. how do I refer to an auto number to fill the textbox with?