Dreams are renewable. No matter what our age or condition, there are still untapped possibilities within us and new beauty waiting to be born.

-Dale Turner-

Kamis, 04 April 2013

# value Datagridview in textbox & by chekbox(in datagridview)



Private Sub DataGridView3_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView3.CellClick
        TextBox3.Text = DataGridView3.Rows(e.RowIndex).Cells(0).Value
        TextBox4.Text = DataGridView3.Rows(e.RowIndex).Cells(1).Value
    End Sub

  Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        For i As Integer = 0 To DataGridView2.RowCount - 2
            If DataGridView2.Rows(i).Cells(0).Value = True Then
                TextBox6.Text = DataGridView2.Rows(i).Cells(1).Value
            End If
            TabControl1.SelectTab(TabPageInput)
            TextBox6.Focus()
        Next
    End Sub

# Control Hide and Show Tabpage in the TabControl (“Example Tabpage2”) For Vb.net 2008



Dim colRemovedTabs As New Collection() ‘’Declaration
Dim TabPage2 As TabPage ‘’=è Form Load
        TabPage2 = TabControl1.TabPages(2)
        colRemovedTabs.Add(TabPage2, TabPage2.Name)
        TabControl1.Controls.Remove(TabPage2)
        TabControl1.SelectTab(TabPage2) à set focus tabpage in tabcontrol
----------------------------------------------------
Private Sub Show_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ‘’=è add Button
        Try
            TabControl1.Controls.Add(colRemovedTabs("TabPage2"))
            colRemovedTabs.Remove(TabPage2.Name)
        Catch ex As Exception
        End Try
    End Sub

# Show Database to Datagridview For Vb.net 2008



Sub tampilFoodMain()’’ ==è Form Load(: Call tampilFoodMain ())
        Da = New OleDbDataAdapter("select * from RestaurantDetailtbl", Conn)
        DS = New DataSet
        DS.Clear()
        Da.Fill(DS, "RestaurantDetailtbl")
        DataGridView1.DataSource = (DS.Tables("RestaurantDetailtbl"))
        DataGridView1.ReadOnly = True
    End Sub

# Call ComboBox From Database and show Fill For Vb.net 2008




Sub StatusRoom()‘’==è Form Load (: Call StatusRoom())
        Cmd = New OleDbCommand("select * FROM StatusRoom", Conn)
        Dr = Cmd.ExecuteReader
        cmbStatus.Items.Clear()
        Do While Dr.Read
            cmbStatus.Items.Add(Dr.Item(0))
        Loop
    End Sub

Sub Status()’’==è combo IelectIndexChanged (: Call Status())
        cmbID.MaxLength = 4
        Cmd = New OleDbCommand("Select * from StatusRoom where Status='" & cmbStatus.Text & "'", Conn)
        Dr = Cmd.ExecuteReader
        Dr.Read()
        Refresh()
        If Dr.HasRows Then
            txtStatus.Text = Dr.Item("Status")
            Exit Sub
        End If
    End Sub