Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim CurrentRow As DataRowView = CType(Me.ComboBox1.Items(Me.ComboBox1.SelectedIndex), DataRowView)
Dim CurrentJobNumber As String = CurrentRow.Item("Job#")
MyView.RowFilter = "Job# = " & CurrentJobNumber.ToString
End Sub
Public Class Form4
Dim WorkProcessDataSet As New DataSet
Dim DV As New DataView
Dim WithEvents DGV As New DataGridView
Dim WithEvents CB As New ComboBox
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Create a DataGridView
Me.Controls.Add(DGV)
DGV.Height = 400
DGV.Width = 400
DGV.Location = New Point(0, 0)
'Add a ComboBox
Me.CB.Location = New Point(0, Me.DGV.Top + Me.DGV.Height + 10)
Me.Controls.Add(Me.CB)
Me.CB.DropDownStyle = ComboBoxStyle.DropDownList
'Add the WorkRelease Table to the DataSet
Dim dt As New DataTable
dt.TableName = "WorkRelease"
dt.Columns.Add("JobNo", System.Type.GetType("System.Int32"))
'Add a lookup table for the ComboBox to the DataSet
Dim dt2 As New DataTable
dt2.TableName = "LookupValues"
dt2.Columns.Add("JobNo", System.Type.GetType("System.Int32"))
'Set the table of the DataView
DV.Table = dt
'Add some fake rows to the WorkRelease DataTable
Dim dr As DataRow = dt.NewRow
dr.Item(0) = 0
dt.Rows.Add(dr)
dr = dt.NewRow
dr.Item(0) = 1
dt.Rows.Add(dr)
dr = dt.NewRow
dr.Item(0) = 2
dt.Rows.Add(dr)
'Add some fake rows to the LookupValues DataTable
dr = dt2.NewRow
dr.Item(0) = 0
dt2.Rows.Add(dr)
dr = dt2.NewRow
dr.Item(0) = 1
dt2.Rows.Add(dr)
dr = dt2.NewRow
dr.Item(0) = 2
dt2.Rows.Add(dr)
'Bind the DataGridView to the DataView
Me.DGV.DataSource = DV
'Bind the ComboBox to the Lookup table
Me.CB.DataSource = dt2
Me.CB.DisplayMember = "JobNo"
Me.CB.ValueMember = "JobNo"
End Sub
Private Sub CB_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CB.SelectedIndexChanged
Dim drv As DataRowView = Me.CB.Items(Me.CB.SelectedIndex)
Me.DV.RowFilter = "JobNo = " & drv.Item("JobNo").ToString
End Sub
End Class