well to be more clearer i would like to provide more information on my form.
this form is displaying only the text boxes right now.so all the input would have to be updated from these dynamic textboxes to the database.
this is my code in the forms load event:
visual basic code:--------------------------------------------------------------------------------
- Private Sub frmDataEntry_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
-
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & Application.StartupPath & "\customer.mdb")
-
Dim cn1 As New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & Application.StartupPath & "\customer.mdb")
-
Dim cmd As OleDbCommand
-
Dim dr As OleDbDataReader
-
Dim dr1 As OleDbDataReader
-
Dim str As String
-
Dim str1 As String
-
Dim cmd1 As OleDbCommand
-
Dim txtBox As TextBox
-
Dim labl As Label
-
Dim pt As Point
-
Dim pt1 As Point
-
Dim cnt As Integer
-
Dim cnt1 As Integer
-
Dim lablsiz As Size = New Size(150, 20)
-
Dim txtsiz As Size = New Size(300, 20)
-
Dim i As Integer
-
Dim ds As DataSet
-
-
Try
-
If cn.State = ConnectionState.Closed Then
-
cn.Open()
-
End If
-
-
cn1.Open()
-
str1 = "SELECT FldAn FROM tblCustomFieldAnswers WHERE AcctNum='" & m_stracctnum1 & "' And CustID = " & m_intcustnum1 & ""
-
cmd1 = New OleDbCommand(str1, cn1)
-
dr1 = cmd1.ExecuteReader
-
-
-
str = "SELECT FieldName FROM tblCustomFields WHERE AcctNum='" & m_stracctnum1 & "'And CustID = " & m_intcustnum1 & ""
-
cmd = New OleDbCommand(str, cn)
-
dr = cmd.ExecuteReader
-
-
-
If dr1.HasRows = False Then
-
-
While dr.Read
-
pt1 = New Point(10, cnt1 + 10)
-
labl = New Label
-
labl.Text = dr(i) & ":"
-
labl.TextAlign = ContentAlignment.MiddleRight
-
labl.Location = pt1
-
labl.Size = lablsiz
-
Me.Controls.Add(labl)
-
pt = New Point(175, cnt + 10)
-
txtBox = New TextBox
-
txtBox.Location = pt
-
txtBox.Size = txtsiz
-
Me.Controls.Add(txtBox)
-
-
cnt = cnt + (txtBox.Height + 15)
-
cnt1 = cnt1 + (labl.Height + 15)
-
End While
-
-
Else
-
While dr.Read
-
pt1 = New Point(10, cnt1 + 10)
-
labl = New Label
-
labl.Text = dr(i) & ":"
-
labl.TextAlign = ContentAlignment.MiddleRight
-
labl.Location = pt1
-
labl.Size = lablsiz
-
Me.Controls.Add(labl)
-
While dr1.Read
-
pt = New Point(175, cnt + 10)
-
txtBox = New TextBox
-
txtBox.Location = pt
-
txtBox.Size = txtsiz
-
Me.Controls.Add(txtBox)
-
txtBox.Text = dr1(i)
-
cnt = cnt + (txtBox.Height + 15)
-
End While
-
cnt1 = cnt1 + (labl.Height + 15)
-
End While
-
End If
-
-
Catch ex As OleDbException
-
-
MessageBox.Show(ex.ToString())
-
-
End Try
-
If cn.State <> ConnectionState.Closed Then
-
cn.Close()
-
End If
-
If cn1.State <> ConnectionState.Closed Then
-
cn1.Close()
-
End If
-
-
End Sub--------------------------------------------------------------------------------
so now when they make changes and hit the edit button the changes made to the text of any textboxes should be stored back to FldAn in customfieldanswers.
please help!!
thanks,