Click here to Skip to main content
15,845,469 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Which Visual Studio is right for ME? Pin
Richard MacCutchan21-Jan-24 22:34
mveRichard MacCutchan21-Jan-24 22:34 
AnswerRe: Which Visual Studio is right for ME? Pin
jschell22-Jan-24 6:42
jschell22-Jan-24 6:42 
AnswerRe: Which Visual Studio is right for ME? Pin
ramsey benson26-Jan-24 12:52
ramsey benson26-Jan-24 12:52 
GeneralRe: Which Visual Studio is right for ME? Pin
Member 1510932527-Jan-24 0:12
Member 1510932527-Jan-24 0:12 
GeneralRe: Which Visual Studio is right for ME? Pin
Richard Andrew x6427-Jan-24 4:13
professionalRichard Andrew x6427-Jan-24 4:13 
Questionmysql to tally Pin
CHANDRA SEKAR Nov202230-Nov-23 21:52
CHANDRA SEKAR Nov202230-Nov-23 21:52 
AnswerRe: mysql to tally Pin
Dave Kreskowiak1-Dec-23 5:27
mveDave Kreskowiak1-Dec-23 5:27 
QuestionHow do i populate say combobox2 depending on a *selected* ms access database table in combobox1 without writing If statements for each and every table in the database in vb.net windows forms Pin
Kudzanai Victor8-Nov-23 19:41
Kudzanai Victor8-Nov-23 19:41 
I would want to prompt user to select a tool name from combobox1, then out automatically, combobox2 gets filled with tool description and size, which is a column in the selected table. Currently i have been using the following code, however the problem comes when i would like to update the database and add another table. This would mean adding the code in the application as well. I would like the application to be able to detect that a new tool table has been added and show that automatically without having to code again



Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

' ADDING TABLE NAMES TO COMBOBOX 1 (TOOL NAME)

    con.Open()

    Dim schemaTable As DataTable = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})

   For Each dr As DataRow In schemaTable.Rows

            Combobox1.Items.Add(dr.Item("TABLE_NAME"))

   Next

End Sub

Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Combobox1.SelectedIndexChanged          

'FILLING COMBOBOX 2 (TOOL DESCRIPTION AND SIZE) DEPENDING ON SELECTION IN COMBOBOX 1 (TOOL NAME)

 If Combobox1.SelectedIndex = 1 Then             

Combobox2.Text = ""                         

con.Open()             

Combobox2.Items.Clear()             

Dim dr As OleDbDataReader             

Dim cmd As New OleDbCommand 

cmd.CommandText = "Select * from 14_POUND_HAMMER"            

cmd.Connection = con             

dr = cmd.ExecuteReader             

While dr.Read                 

Combobox2.Items.Add(dr.GetString(1))              

End While             

dr.Close()             

con.Close()



 ElseIf Combobox1.SelectedIndex = 2 Then             

Combobox2.Text = ""                       

con.Open()             

Combobox2.Items.Clear()             

Dim dr As OleDbDataReader             

Dim cmd As New OleDbCommand             

cmd.CommandText = "Select * from 3_QUARTER_IMPACT_WRENCH"             
cmd.Connection = con             

dr = cmd.ExecuteReader             

While dr.Read                 

Combobox2.Items.Add(dr.GetString(0))             

End While             

dr.Close()             

con.Close()



ElseIf Combobox1.SelectedIndex = 3 Then             

Combobox2.Text = ""                         

con.Open()             

Combobox2.Items.Clear()             

Dim dr As OleDbDataReader             

Dim cmd As New OleDbCommand             

cmd.CommandText = "Select * from ABRASIVE_CUT_OFF_SAW "        
cmd.Connection = con             

dr = cmd.ExecuteReader             

While dr.Read                 

Combobox2.Items.Add(dr.GetString(0))             

End While             

dr.Close()             

con.Close() 

AnswerRe: How do i populate say combobox2 depending on a *selected* ms access database table in combobox1 without writing If statements for each and every table in the database in vb.net windows forms Pin
Richard MacCutchan8-Nov-23 22:39
mveRichard MacCutchan8-Nov-23 22:39 
AnswerRe: How do i populate say combobox2 depending on a *selected* ms access database table in combobox1 without writing If statements for each and every table in the database in vb.net windows forms Pin
jschell9-Nov-23 8:18
jschell9-Nov-23 8:18 
QuestionChange Field Data Type in SQLite DB and Use with changes Pin
Choroid27-Oct-23 16:47
Choroid27-Oct-23 16:47 
AnswerRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan27-Oct-23 23:24
mveRichard MacCutchan27-Oct-23 23:24 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid28-Oct-23 9:05
Choroid28-Oct-23 9:05 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan28-Oct-23 9:54
mveRichard MacCutchan28-Oct-23 9:54 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid28-Oct-23 21:57
Choroid28-Oct-23 21:57 
AnswerRe: Change Field Data Type in SQLite DB and Use with changes Pin
Dave Kreskowiak28-Oct-23 5:39
mveDave Kreskowiak28-Oct-23 5:39 
AnswerRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid28-Oct-23 21:55
Choroid28-Oct-23 21:55 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan28-Oct-23 23:33
mveRichard MacCutchan28-Oct-23 23:33 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid29-Oct-23 7:02
Choroid29-Oct-23 7:02 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan29-Oct-23 7:20
mveRichard MacCutchan29-Oct-23 7:20 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid29-Oct-23 19:18
Choroid29-Oct-23 19:18 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan29-Oct-23 23:39
mveRichard MacCutchan29-Oct-23 23:39 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid30-Oct-23 6:30
Choroid30-Oct-23 6:30 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan30-Oct-23 7:24
mveRichard MacCutchan30-Oct-23 7:24 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
jschell31-Oct-23 6:58
jschell31-Oct-23 6:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.