(26-09-16, 09:50 PM)سعود كتب : شوف الكود
PHP كود :
Public Class Form1
Dim con As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=db.accdb")
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ListBox1.Items.Add(InputBox(""))
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If ListBox1.Items.Count > 2 Then
Dim cm As New OleDb.OleDbCommand("", con)
Dim allstring As String = ""
For r = 0 To ListBox1.Items.Count - 1
allstring &= ListBox1.Items.Item(r).ToString & "@"
Next
cm.CommandText = "insert into tb(t) values(@t)"
cm.Parameters.AddWithValue("@t", allstring)
Try
con.Open()
cm.ExecuteNonQuery()
MsgBox("Done")
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Critical)
End Try
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim cm As New OleDb.OleDbCommand("", con)
cm.CommandText = "select * from tb"
Dim allstring As String = ""
Dim dr As OleDb.OleDbDataReader
Try
con.Open()
dr = cm.ExecuteReader
While dr.Read
allstring &= dr(1)
End While
For Each h In allstring.Split("@")
ListBox2.Items.Add(h)
Next
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Critical)
End Try
End Sub
End Class![]()
(16-10-16, 06:09 PM)makky كتب :(26-09-16, 09:50 PM)سعود كتب : شوف الكود
PHP كود :
Public Class Form1
Dim con As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=db.accdb")
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ListBox1.Items.Add(InputBox(""))
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If ListBox1.Items.Count > 2 Then
Dim cm As New OleDb.OleDbCommand("", con)
Dim allstring As String = ""
For r = 0 To ListBox1.Items.Count - 1
allstring &= ListBox1.Items.Item(r).ToString & "@"
Next
cm.CommandText = "insert into tb(t) values(@t)"
cm.Parameters.AddWithValue("@t", allstring)
Try
con.Open()
cm.ExecuteNonQuery()
MsgBox("Done")
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Critical)
End Try
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim cm As New OleDb.OleDbCommand("", con)
cm.CommandText = "select * from tb"
Dim allstring As String = ""
Dim dr As OleDb.OleDbDataReader
Try
con.Open()
dr = cm.ExecuteReader
While dr.Read
allstring &= dr(1)
End While
For Each h In allstring.Split("@")
ListBox2.Items.Add(h)
Next
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Critical)
End Try
End Sub
End Class![]()
الحمد لله توصلت الي حل وتم عمل اول اصدار من البرنامج.جزاك الله خيرا اخي سعود

