11-11-18, 10:36 PM
(11-11-18, 06:54 PM)asemshahen5 كتب :كود :
'ضع هذا في مديول
Public DGV_Account_Code As Integer
'هذا في فورم الذي يحوي داتا غريد فيو
Private Sub DGVTestConn_DoubleClick(sender As Object, e As EventArgs) Handles DGVTestConn.DoubleClick
'ضع هذا في حدث البل كليك في الداتا غريد فيو
DGV_Account_Code = 0
DGV_Account_Code = DataGridViewX1.CurrentRow.Cells(0).Value
close()
End Sub
'هذا في فورم الذي يحوي داتا غريد فيو
Private Sub EncryptConnectionStringForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
DGV_Account_Code = 0
DGV_Account_Code = DataGridViewX1.CurrentRow.Cells(0).Value
close()
End Sub
'هذا في كود استدعاء نافذة الغريد فيو
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
System_Language(Chart_Of_Account) 'this code is general methode
Dim New_Chart_Of_Account As New Chart_Of_Account
New_Chart_Of_Account.ShowDialog()
Chart_Of_Account.show_record_data(DGV_Account_Code)
End Sub
Public Sub show_record_data(ByVal x As Integer)
Dim adp As New SqlClient.SqlDataAdapter("select * from Company_Tree where Account_Code=" & x, sqlconn)
Dim dt As New DataTable
dt.Clear()
adp.Fill(dt)
If dt.Rows.Count > 0 Then
Dim dr As DataRow = dt.Rows(0)
Account_Status.Checked = dr!Account_Status
Account_Type.Checked = dr!Account_Type
Account_Status.Checked = dr!Account_Status
If dr!Account_Nature = True Then
Debit.Checked = True
Credit.Checked = False
Else
Debit.Checked = False
Credit.Checked = True
End If
For Each Ctrl In Grp1.Controls
If TypeOf Ctrl Is TextBox And dt.Columns.Contains(Ctrl.Name) Then
Ctrl.Text = dr.Item(Ctrl.Name)
End If
Next
For Each Ctrl In Grp2.Controls
If TypeOf Ctrl Is TextBox And dt.Columns.Contains(Ctrl.Name) Then
Ctrl.Text = dr.Item(Ctrl.Name)
End If
Next
For Each Ctrl In Grp3.Controls
If TypeOf Ctrl Is TextBox And dt.Columns.Contains(Ctrl.Name) Then
Ctrl.Text = dr.Item(Ctrl.Name)
End If
If TypeOf Ctrl Is ComboBox And dt.Columns.Contains(Ctrl.Name) Then
Ctrl.Text = dr.Item(Ctrl.Name)
End If
Next
For Each Ctrl In Grp4.Controls
If TypeOf Ctrl Is TextBox And dt.Columns.Contains(Ctrl.Name) Then
Ctrl.Text = dr.Item(Ctrl.Name)
End If
Next
Date_Create_Account.Value = dr!Date_Create_Account
Change.Text = 0
End If
End Sub
شكرا لك اخي الفاضل على الرد راح اجرب الكود واخبرك