1 Imports System.Data.SqlClient 2 3 Public Class Form3 4 Dim con As New SqlConnection 5 Dim myconstring As String = "Data Source=ETA-TESTSRVR;Initial Catalog=Procurement;Integrated Security=True" 6 7 Private Sub E2BindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles E2BindingNavigatorSaveItem.Click 8 9 Me.Validate() 10 Me.E2BindingSource.EndEdit() 11 Me.TableAdapterManager.UpdateAll(Me.ProcurementDataSet) 12 13 End Sub 14 15 Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 16 17 'TODO: This line of code loads data into the 'ProcurementDataSet.E1' table. You can move, or remove it, as needed. 18 Me.E1TableAdapter.FillBy1(Me.ProcurementDataSet.E1) 19 20 'TODO: This line of code loads data into the 'ProcurementDataSet.E2' table. You can move, or remove it, as needed. 21 Me.E2TableAdapter.Fill(Me.ProcurementDataSet.E2) 22 23 End Sub 24 25 Private Sub Mat_Sub_NoComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Mat_Sub_NoComboBox.SelectedIndexChanged 26 27 con.ConnectionString = myconstring 28 29 'Automated Serial Number 30 Dim da As New SqlDataAdapter("SELECT max(sl_no)+1 as max FROM e1 where project_id='" + Project_IDTextBox.Text + "'", con) 31 Dim dt As New DataTable 32 da.Fill(dt) 33 Sl_NoTextBox.Text = dt.Rows(0).Item("max").ToString 34 If Sl_NoTextBox.Text = "" Then 35 Sl_NoTextBox.Text = 1 36 End If 37 38 'Fetching Data to Textbox 39 Dim da1 As New SqlDataAdapter("SELECT Project_ID,Trade,Fix,Material_Description FROM Mat_e1_prj where mat_sub_no='" + Mat_Sub_NoComboBox.SelectedValue.ToString + "'", con) 40 Dim dt1 As New DataTable 41 da1.Fill(dt1) 42 Project_IDTextBox.Text = dt1.Rows(0).Item("Project_ID").ToString 43 TradeTextBox.Text = dt1.Rows(0).Item("Trade").ToString 44 FixTextBox.Text = dt1.Rows(0).Item("fix").ToString 45 DescriptionTextBox.Text = dt1.Rows(0).Item("Material_Description").ToString 46 47 End Sub 48 49 End Class
Mat_Sub_NoComboBox.SelectedValue.ToString
Mat_Sub_NoComboBox.SelectedValue
Nothing
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)