Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27379

Trying to copy data from scattered cells in excel to textboxes in vs2012 using arrays

$
0
0
I am having a hard time getting this to work. I have a worksheet in excel that has company data scattered in different cells that i need to automatically move to my textboxes. I am using visual studio 2012 pro using vb. Below is some of the code i have tried. any suggestions?? :confused:
Dim boxes As New List(Of TextBox)

Dim strTextboxLocation(100) As String
Dim intRow(100) As Integer
Dim intColumn(100) As Integer

'**Declare Variables**
Dim strCompanyName, strCompanyPhone, strFax, strAddress1, strAddress2, strCompanyContact As String
Dim strCompanyContactPhone, strCompanyContactEmail, strWellName, strSurveyType, strCountry, strCounty, strSurveyBy, strField As String
Dim strSurveyDateFrom, strSurveyDateTo, strFieldNotes1, strFieldNotes2, strFieldNotes3, strFieldNotes4, strFieldNotes5 As String
Dim strTubingSizeWeight, strCasingSizeWeight, strTubingDepthFrom, strTubingDepthTo, strCasingDepthFrom, strCasingDepthTo As String
Dim strKB, strPackerDepth, strPlugBack, strTag, strGas, strOil, strWater, strInjGas, strFlowingWhp, strFlowingCsg As String
Dim strShutInWhp, strShutInCsg, strPerfTop1, strPerfBtm1, strPerfMid1, strPerfTop2, strPerfBtm2, strPerfTop3, strPerfBtm3 As String
Dim strPerfTop4, strPerfBtm4, strMaxFlowPsi, strMaxFlowTemp, strMaxShutInPsi, strMaxShutInTemp As String


Private Sub frmJobSheet_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Dim i As Integer

'*** Initilize arrays ***
For i = 1 To 100
strTextboxLocation(i) = ""
intRow(i) = 0
intColumn(i) = 0
Next


boxes.Add(txtCompanyName)

'*** Store Locations ***
strTextboxLocation(1) = "txtCompanyName.Text"
intRow(1) = 3
intColumn(1) = 9

strTextboxLocation(2) = "txtCompanyPhone.Text"
intRow(2) = 4
intColumn(2) = 9

LoadInformationFromFile()

Viewing all articles
Browse latest Browse all 27379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>