Click here to Skip to main content
15,886,963 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Which Visual Studio is right for ME? Pin
jschell22-Jan-24 5:42
jschell22-Jan-24 5:42 
AnswerRe: Which Visual Studio is right for ME? Pin
ramsey benson26-Jan-24 11:52
ramsey benson26-Jan-24 11:52 
GeneralRe: Which Visual Studio is right for ME? Pin
Member 1510932526-Jan-24 23:12
Member 1510932526-Jan-24 23:12 
GeneralRe: Which Visual Studio is right for ME? Pin
Richard Andrew x6427-Jan-24 3:13
professionalRichard Andrew x6427-Jan-24 3:13 
AnswerRe: Which Visual Studio is right for ME? Pin
Member 1622894123-Mar-24 14:38
Member 1622894123-Mar-24 14:38 
Questionmysql to tally Pin
CHANDRA SEKAR Nov202230-Nov-23 20:52
CHANDRA SEKAR Nov202230-Nov-23 20:52 
AnswerRe: mysql to tally Pin
Dave Kreskowiak1-Dec-23 4:27
mveDave Kreskowiak1-Dec-23 4: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 18:41
Kudzanai Victor8-Nov-23 18: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 21:39
mveRichard MacCutchan8-Nov-23 21: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 7:18
jschell9-Nov-23 7:18 
QuestionChange Field Data Type in SQLite DB and Use with changes Pin
Choroid27-Oct-23 15:47
Choroid27-Oct-23 15:47 
AnswerRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan27-Oct-23 22:24
mveRichard MacCutchan27-Oct-23 22:24 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid28-Oct-23 8:05
Choroid28-Oct-23 8:05 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan28-Oct-23 8:54
mveRichard MacCutchan28-Oct-23 8:54 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid28-Oct-23 20:57
Choroid28-Oct-23 20:57 
AnswerRe: Change Field Data Type in SQLite DB and Use with changes Pin
Dave Kreskowiak28-Oct-23 4:39
mveDave Kreskowiak28-Oct-23 4:39 
AnswerRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid28-Oct-23 20:55
Choroid28-Oct-23 20:55 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan28-Oct-23 22:33
mveRichard MacCutchan28-Oct-23 22:33 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid29-Oct-23 6:02
Choroid29-Oct-23 6:02 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan29-Oct-23 6:20
mveRichard MacCutchan29-Oct-23 6:20 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid29-Oct-23 18:18
Choroid29-Oct-23 18:18 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan29-Oct-23 22:39
mveRichard MacCutchan29-Oct-23 22:39 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Choroid30-Oct-23 5:30
Choroid30-Oct-23 5:30 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
Richard MacCutchan30-Oct-23 6:24
mveRichard MacCutchan30-Oct-23 6:24 
GeneralRe: Change Field Data Type in SQLite DB and Use with changes Pin
jschell31-Oct-23 5:58
jschell31-Oct-23 5: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.