Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I'm kind of confused as you have your count right there. Is that something you added in and you were just showing or do I misunderstand something?Dim iRows As Integer = oTable.Rows.Count
Imports System.Data.SqlClient
Public Class Form12
Private Function TestIt() As DataTable
Dim sParm As String = Chr(39) & Me.TextBox1.Text.ToString & Chr(39)
Dim tParm As String = Chr(39) & Me.TextBox2.Text.ToString & Chr(39)
Dim uParm As String = Chr(39) & Me.TextBox3.Text.ToString & Chr(39)
Dim vParm As String = Chr(39) & Me.TextBox4.Text.ToString & Chr(39)
Dim wParm As String = Chr(39) & Me.TextBox5.Text.ToString & Chr(39)
Dim connectionString As String = "Data Source=99.9.9.999; " & _
"Initial Catalog=PROD; " & _
"Persist Security Info=True; " & _
"User ID=Main; " & _
"Password=lawson"
Dim sSQL As String = "SELECT COMPANY, FISCAL_YEAR, ACCT_PERIOD, CONTROL_GROUP, LINE_NBR, POSTING_DATE, OBJ_ID, STATUS, ACCT_UNIT, ACCOUNT, TRAN_AMOUNT, ACCT_AMOUNT, VAR_LEVELS FROM GLTRANS WHERE COMPANY = " & sParm & " AND FISCAL_YEAR = " & tParm & " AND ACCT_PERIOD = " & uParm & " AND CONTROL_GROUP = " & vParm & " AND POSTING_DATE = " & wParm & ";"
Dim oCn As New SqlConnection(connectionString)
Dim oCm As New SqlCommand(sSQL, oCn)
oCm.CommandType = CommandType.Text
Dim oDa As New SqlDataAdapter(oCm)
Dim oTable As New DataTable()
oCn.Open()
oDa.Fill(oTable)
oCn.Close()
oCn.Dispose()
Return oTable
End Function
Private Sub BtnPull_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPull.Click
Me.Hide()
Dim CurrentData As DataTable
CurrentData = TestIt()
MAIN1.Show()
For count As Integer = 0 To 11
MAIN1.Controls("txtCompany" & count + 1).Text = CurrentData.Rows(count).Item("COMPANY")
MAIN1.Controls("txtFiscalYear" & count + 1).Text = CurrentData.Rows(count).Item("FISCAL_YEAR")
MAIN1.Controls("txtAcctPeriod" & count + 1).Text = CurrentData.Rows(count).Item("ACCT_PERIOD")
MAIN1.Controls("txtControlGroup" & count + 1).Text = CurrentData.Rows(count).Item("CONTROL_GROUP")
MAIN1.Controls("txtLineNbr" & count + 1).Text = CurrentData.Rows(count).Item("LINE_NBR")
MAIN1.Controls("txtPostingDate" & count + 1).Text = CurrentData.Rows(count).Item("POSTING_DATE")
MAIN1.Controls("txtObjID" & count + 1).Text = CurrentData.Rows(count).Item("OBJ_ID")
MAIN1.Controls("txtStatus" & count + 1).Text = CurrentData.Rows(count).Item("STATUS")
MAIN1.Controls("txtAcctUnit" & count + 1).Text = CurrentData.Rows(count).Item("ACCT_UNIT")
MAIN1.Controls("txtAccount" & count + 1).Text = CurrentData.Rows(count).Item("ACCOUNT")
MAIN1.Controls("TranAmt" & count + 1).Text = CurrentData.Rows(count).Item("TRAN_AMOUNT")
'ACCT_AMOUNT missing? If not use below
'MAIN1.Controls("ReplaceWithCorrectTextBoxName" & count + 1).Text = CurrentData.Rows(count).Item("ACCT_AMOUNT")
MAIN1.Controls("VARLEVEL" & count + 1).Text = CurrentData.Rows(count).Item("VAR_LEVELS")
Next
End Sub
End Class
Dim SName As String = "TextBox.Text"
Dim i As Integer
For i = 0 To 12
Dim TName As String = SName & CStr(iLvalue) & CStr(i)
For iLvalue = 0 To iRows - 1
TName = sParams(iLvalue, 0)
TName = sParams(iLvalue, 1)
TName = sParams(iLvalue, 2)
TName = sParams(iLvalue, 3)
TName = sParams(iLvalue, 4)
TName = sParams(iLvalue, 5)
TName = sParams(iLvalue, 6)
TName = sParams(iLvalue, 7)
TName = sParams(iLvalue, 8)
TName = sParams(iLvalue, 10)
TName = sParams(iLvalue, 11)
TName = sParams(iLvalue, 12)
Next
Next
Dim SName As String = "TextBox"
For iLvalue = 0 To iRows - 1
Dim i As Integer
For i = 0 To 12
Dim TName As New TextBox
TName.Name = SName & CStr(iLvalue) & CStr(i)
TName.Text = sParams(iLvalue, i)
Form6.Controls.Add(TName)
Next
Next
Private Sub BtnPull_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPull.Click
Me.Hide()
Dim AParams As Array
AParams = TestIt()
Dim F6 As New Form6(AParams)
[Red]F6.Show()[/Red]
End Sub