I'm really bad at programming, and my code is really funny.. please help.. thanks in advance.. by the way, my app is used to read data from a txt file and save to access database.. but i can only get the first occurrence of the string and its "value" but the second occurrence of the same string it can't.. i also used textboxes and bind it to database to save the values from the file.. i really don't know what to do.
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Threading
Imports System.Windows.Forms
Public Class Data_Update
Dim SearchDir As String
Dim ThisFile As String
Dim list As System.Collections.ObjectModel.ReadOnlyCollection(Of String)
Dim startstr As String
Dim sellength As String
Public Sub New()
InitializeComponent()
Me.GPSDatabaseTableAdapter.Fill(Me._HPQ2014_Temp_DataSet.GPSDatabase)
RadGridView1.TableElement.BeginUpdate()
RadGridView1.EnableFiltering = True
RadGridView1.EnableGrouping = False
RadGridView1.AllowAddNewRow = False
RadGridView1.ReadOnly = True
RadGridView1.MasterTemplate.ShowHeaderCellButtons = True
RadGridView1.MasterTemplate.ShowFilteringRow = False
RadGridView1.MasterTemplate.BestFitColumns()
RadGridView1.TableElement.EndUpdate()
End Sub
Private Sub DataUpdate_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Startup.Show()
End Sub
Private Sub ShowCntrl_btn_Click(sender As Object, e As EventArgs) Handles ShowCntrl_btn.Click
Data_Update_Controls.Visible = False
Data_Update_Controls.Visible = True
End Sub
Private Sub SourcePath_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SourcePath_btn.Click
SourceList_lst.Items.Clear()
ReadIt.ProgressBar1.Value = 0
SetPath()
End Sub
Public Sub SetPath()
Me.Refresh()
With FolderBrowserDialog1
.Description = "Select directory of GPS Source files"
.ShowDialog()
End With
ReadIt.Show()
End Sub
Public Sub readDir()
SearchDir = FolderBrowserDialog1.SelectedPath
SourcePath_txtbox.Text = SearchDir
Try
Windows.Forms.Cursor.Current = Cursors.WaitCursor
ReadIt.Update()
list = My.Computer.FileSystem.FindInFiles( _
SearchDir, Label1.Text, _
True, FileIO.SearchOption.SearchAllSubDirectories, "*.js")
For Each name As String In list
ListBox1.Items.Add(name)
Next
ReadIt.ProgressBar1.Maximum = ListBox1.Items.Count
StringSearch()
SourceList_lst.SelectedIndex = 0
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Error!")
End Try
ReadIt.Close()
Data_Update_Controls.Show()
End Sub
Private Sub StringSearch()
For Each name As String In list
ReadIt.Update()
SourceList_lst.Items.Add(name)
SourceCount_lbl.Text = SourceList_lst.Items.Count & " files found."
SourceCount_lbl.Update()
ReadIt.Textbox1.Text = name
ReadIt.ProgressBar1.Value = SourceList_lst.Items.Count
Next
End Sub
Public Sub GPS_lat()
startstr = Label1.Text
sellength = Label1.Text.Length
Readme()
Latitude_txt.Paste()
Dim Lat_end As Integer : Dim endstr As String = Label2.Text
Lat_end = InStr(1, Latitude_txt.Text, endstr)
If Lat_end > 0 Then
With Latitude_txt
.SelectionStart = Lat_end - 1
.SelectionLength = 100
.Cut()
End With
End If
GPS_lon()
End Sub
Public Sub GPS_lon()
startstr = Label2.Text
sellength = Label2.Text.Length
Readme()
Longitude_txt.Paste()
Dim Lon_end As Integer : Dim endstr As String = Label3.Text
Lon_end = InStr(1, Longitude_txt.Text, endstr)
If Lon_end > 0 Then
With Longitude_txt
.SelectionStart = Lon_end - 1
.SelectionLength = 40
.Cut()
End With
End If
GPS_alt()
End Sub
Public Sub GPS_alt()
startstr = Label3.Text
sellength = Label3.Text.Length
Readme()
Altitude_txt.Paste()
Dim Alt_end As Integer : Dim endstr As String = Label4.Text
Alt_end = InStr(1, Altitude_txt.Text, endstr)
If Alt_end > 0 Then
With Altitude_txt
.SelectionStart = Alt_end - 1
.SelectionLength = 40
.Cut()
End With
End If
GPS_acc()
End Sub
Public Sub GPS_acc()
startstr = Label4.Text
sellength = Label4.Text.Length
Readme()
Accuracy_txt.Paste()
Dim Acc_end As Integer : Dim endstr As String = Label5.Text
Acc_end = InStr(1, Accuracy_txt.Text, endstr)
If Acc_end > 0 Then
With Accuracy_txt
.SelectionStart = Acc_end - 1
.SelectionLength = 50
.Cut()
End With
End If
Brgy()
End Sub
Public Sub Brgy()
brgy_tmp1.Clear()
Dim brgy1 As Integer : Dim brgys As String = Label9.Text
brgy1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, brgys)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = brgy1 + 7
.SelectionLength = 3
End With
On Error Resume Next
Dim be As Integer = CInt(Data_Update_Controls.SourceView_txtbox.SelectedText)
Dim brgy(50)
brgy(1) = "Agnas (San Miguel Island)"
brgy(2) = "Bacolod"
brgy(3) = "Bangkilingan"
brgy(4) = "Bantayan"
brgy(5) = "Baranghawon"
brgy(6) = "Basagan"
brgy(7) = "Basud (Pob.)"
brgy(8) = "Bogñabong"
brgy(9) = "Bombon (Pob.)"
brgy(10) = "Bonot"
brgy(11) = "San Isidro (Boring)"
brgy(12) = "Buang"
brgy(13) = "Buhian"
brgy(14) = "Cabagñan"
brgy(15) = "Cobo"
brgy(16) = "Comon "
brgy(17) = "Cormidal"
brgy(18) = "Divino Rostro (Pob.)"
brgy(19) = "Fatima"
brgy(20) = "Guinobat"
brgy(21) = "Hacienda (San Miguel Island)"
brgy(22) = "Magapo"
brgy(23) = "Mariroc"
brgy(24) = "Matagbac"
brgy(25) = "Oras"
brgy(26) = "Oson"
brgy(27) = "Panal"
brgy(29) = "Pawa"
brgy(30) = "Pinagbobong"
brgy(31) = "Quinale Cabasan (Pob.)"
brgy(32) = "Quinastillojan"
brgy(33) = "Rawis (San Miguel Island)"
brgy(34) = "Sagurong (San Miguel Island)"
brgy(35) = "Salvacion"
brgy(36) = "San Antonio"
brgy(37) = "San Carlos"
brgy(38) = "San Juan (Pob.)"
brgy(39) = "San Lorenzo"
brgy(40) = "San Ramon"
brgy(41) = "San Roque"
brgy(42) = "San Vicente"
brgy(44) = "Santo Cristo (Pob.)"
brgy(45) = "Sua-Igot"
brgy(46) = "Tabiguian"
brgy(48) = "Tagas"
brgy(49) = "Tayhi (Pob.)"
brgy(50) = "Visita (San Miguel Island)"
Brgy_tmp.Text = (brgy(be))
Brgy_tmp.Update()
Purok()
End Sub
Public Sub Purok()
Dim zone1 As Integer : Dim zone As String = Label8.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + 7
.SelectionLength = 1
End With
Purok_tmp.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Purok_tmp.Update()
HHNum()
End Sub
Public Sub HHNum()
Dim hhnum3 As Integer : Dim hhnum33 As String = Label11.Text
hhnum3 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, hhnum33)
If hhnum3 > 0 Then
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = hhnum3 + 6
.SelectionLength = 20
End With
HHNumber_tmp.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Else
GoTo OtherType
End If
Dim hhnum4 As Integer : Dim hhnum44 As String = Label86.Text
hhnum4 = InStr(1, HHNumber_tmp.Text, hhnum44)
If hhnum4 > 0 Then
With HHNumber_tmp
.SelectionStart = hhnum4 - 1
.SelectionLength = 30
.Cut()
.Update()
End With
End If
HHName()
Exit Sub
OtherType:
Dim hhnum1 As Integer : Dim hhnum As String = Label10.Text
hhnum1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, hhnum)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = hhnum1 + 5
.SelectionLength = 20
End With
HHNumber_tmp.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Dim hhnum2 As Integer : Dim hhnum22 As String = Label87.Text
hhnum2 = InStr(1, HHNumber_tmp.Text, hhnum22)
With HHNumber_tmp
.SelectionStart = hhnum2 - 1
.SelectionLength = 30
.Cut()
.Update()
End With
HHName()
End Sub
Public Sub Respondent()
Dim posName1 As Integer : Dim startofstring1 As String = Label86.Text
posName1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, startofstring1)
Data_Update_Controls.SourceView_txtbox.SelectionStart = posName1 + (Label86.Text.Length - 1)
Data_Update_Controls.SourceView_txtbox.SelectionLength = 80
respo_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Dim posName2 As Integer : Dim endofstring2 As String = Chr(34)
posName2 = InStr(1, respo_txt.Text, endofstring2)
On Error Resume Next
respo_txt.SelectionStart = posName2 - 1
respo_txt.SelectionLength = 100
respo_txt.Cut()
respo_txt.Update()
housetype()
End Sub
Public Sub housetype()
Dim zone1 As Integer : Dim zone As String = Label12.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label12.Text.Length - 1)
.SelectionLength = 1
End With
housetype_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
housetype_txt.Update()
bedrooms()
End Sub
Public Sub bedrooms()
Dim zone1 As Integer : Dim zone As String = Label13.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label13.Text.Length - 1)
.SelectionLength = 1
End With
bedrooms_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
roof()
End Sub
Public Sub roof()
Dim zone1 As Integer : Dim zone As String = Label14.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label14.Text.Length - 1)
.SelectionLength = 1
End With
rooftype_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
rooftype_txt.Update()
wall()
End Sub
Public Sub wall()
Dim zone1 As Integer : Dim zone As String = Label15.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label15.Text.Length - 1)
.SelectionLength = 1
End With
walltype_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
walltype_txt.Update()
ofws()
End Sub
Public Sub ofws()
Dim zone1 As Integer : Dim zone As String = Label16.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label16.Text.Length - 1)
.SelectionLength = 1
End With
ofw_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
ofw_txt.Update()
nucfam()
End Sub
Public Sub nucfam()
Dim zone1 As Integer : Dim zone As String = Label17.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label17.Text.Length - 1)
.SelectionLength = 1
End With
numfamilies_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
numfamilies_txt.Update()
famsize()
End Sub
Public Sub famsize()
Dim zone1 As Integer : Dim zone As String = Label21.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label21.Text.Length - 1)
.SelectionLength = 1
End With
fammembers_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
fammembers_txt.Update()
HHName()
End Sub
Public Sub HHName()
Dim pos_last1 As Integer : Dim startofstring_last As String = Label23.Text
pos_last1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, startofstring_last)
Data_Update_Controls.SourceView_txtbox.SelectionStart = pos_last1 + (Label23.Text.Length - 1)
Data_Update_Controls.SourceView_txtbox.SelectionLength = 20
lastname_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Dim pos_last2 As Integer : Dim endofstring_last As String = Chr(34)
pos_last2 = InStr(1, lastname_txt.Text, endofstring_last)
On Error Resume Next
lastname_txt.SelectionStart = pos_last2 - 1
lastname_txt.SelectionLength = 20
lastname_txt.Cut()
lastname_txt.Update()
Dim pos_first1 As Integer : Dim startofstring_first As String = Label24.Text
pos_first1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, startofstring_first)
Data_Update_Controls.SourceView_txtbox.SelectionStart = pos_first1 + (Label24.Text.Length - 1)
Data_Update_Controls.SourceView_txtbox.SelectionLength = 20
firstname_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Dim pos_first2 As Integer
Dim endofstring_first As String = Chr(34)
pos_first2 = InStr(1, firstname_txt.Text, endofstring_first)
On Error Resume Next
firstname_txt.SelectionStart = pos_first2 - 1
firstname_txt.SelectionLength = 50
firstname_txt.Cut()
firstname_txt.Update()
Dim pos_mid1 As Integer : Dim startofstring_mid As String = Label25.Text
pos_mid1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, startofstring_mid)
Data_Update_Controls.SourceView_txtbox.SelectionStart = pos_mid1 + (Label25.Text.Length - 1)
Data_Update_Controls.SourceView_txtbox.SelectionLength = 20
midname_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Dim pos_mid2 As Integer : Dim endofstring_mid As String = Chr(34)
pos_mid2 = InStr(1, midname_txt.Text, endofstring_mid)
On Error Resume Next
midname_txt.SelectionStart = pos_mid2 - 1
midname_txt.SelectionLength = 50
midname_txt.Cut()
midname_txt.Update()
End Sub
Public Sub nuclear()
Dim zone1 As Integer : Dim zone As String = Label26.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label26.Text.Length - 1)
.SelectionLength = 1
End With
nuclear_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
nuclear_txt.Update()
rel()
End Sub
Public Sub rel()
Dim zone1 As Integer : Dim zone As String = Label27.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label27.Text.Length - 1)
.SelectionLength = 1
End With
relation2head_txt.Paste()
On Error Resume Next
relation2head_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
relation2head_txt.Update()
sex()
End Sub
Public Sub sex()
Dim zone1 As Integer : Dim zone As String = Label28.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label28.Text.Length - 1)
.SelectionLength = 1
End With
On Error Resume Next
sex_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
sex_txt.Update()
birth()
End Sub
Public Sub birth()
Dim zone1 As Integer : Dim zone As String = Label29.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label29.Text.Length - 1)
.SelectionLength = 10
End With
birth_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
birth_txt.Update()
age()
End Sub
Public Sub age()
Dim zone1 As Integer : Dim zone As String = Label30.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label30.Text.Length - 1)
.SelectionLength = 10
End With
age_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Dim _end As Integer : Dim endstr As String = ","
_end = InStr(1, age_txt.Text, endstr)
With age_txt
.SelectionStart = _end - 1
.SelectionLength = 20
.Cut()
.Update()
End With
birthreg()
End Sub
Public Sub birthreg()
Dim zone1 As Integer : Dim zone As String = Label31.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label31.Text.Length - 1)
.SelectionLength = 1
End With
birthreg_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
birthreg_txt.Update()
civilstat()
End Sub
Public Sub civilstat()
Dim zone1 As Integer : Dim zone As String = Label32.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label32.Text.Length - 1)
.SelectionLength = 1
End With
civilstat_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
civilstat_txt.Update()
educ()
End Sub
Public Sub educ()
Dim zone1 As Integer : Dim zone As String = Label37.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label37.Text.Length - 1)
.SelectionLength = 20
End With
educattain_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Dim _end As Integer : Dim endstr As String = Label67.Text
_end = InStr(1, educattain_txt.Text, endstr)
With educattain_txt
.SelectionStart = _end - 1
.SelectionLength = 20
.Cut()
.Update()
End With
literacy()
End Sub
Public Sub literacy()
Dim zone1 As Integer : Dim zone As String = Label144.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label144.Text.Length - 1)
.SelectionLength = 1
End With
literacy_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
literacy_txt.Update()
voter()
End Sub
Public Sub voter()
Dim zone1 As Integer : Dim zone As String = Label38.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label38.Text.Length - 1)
.SelectionLength = 1
End With
On Error Resume Next
votereg_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
votereg_txt.Update()
voted()
End Sub
Public Sub voted()
Dim zone1 As Integer : Dim zone As String = Label39.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label39.Text.Length - 1)
.SelectionLength = 1
End With
votelast_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
votelast_txt.Update()
job()
End Sub
Public Sub job()
Dim pos_last1 As Integer : Dim startofstring_last As String = Label40.Text
pos_last1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, startofstring_last)
Data_Update_Controls.SourceView_txtbox.SelectionStart = pos_last1 + (Label40.Text.Length - 1)
Data_Update_Controls.SourceView_txtbox.SelectionLength = 300
Data_Update_Controls.SourceView_txtbox.Copy()
occupation_txt.Paste()
Dim pos_last2 As Integer : Dim endofstring_last As String = Label41.Text
pos_last2 = InStr(1, occupation_txt.Text, endofstring_last)
On Error Resume Next
occupation_txt.SelectionStart = pos_last2 - 1
occupation_txt.SelectionLength = 300
occupation_txt.Cut()
jobnature()
End Sub
Public Sub jobnature()
Dim zone1 As Integer : Dim zone As String = Label44.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label44.Text.Length - 1)
.SelectionLength = 1
.Copy()
End With
employment_txt.Paste()
workclass()
End Sub
Public Sub workclass()
Dim zone1 As Integer : Dim zone As String = Label45.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label45.Text.Length - 1)
.SelectionLength = 1
End With
workclass_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
workclass_txt.Update()
incomecash()
End Sub
Public Sub incomecash()
Dim pos_last1 As Integer : Dim startofstring_last As String = Label46.Text
pos_last1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, startofstring_last)
Data_Update_Controls.SourceView_txtbox.SelectionStart = pos_last1 + (Label46.Text.Length - 1)
Data_Update_Controls.SourceView_txtbox.SelectionLength = 4
annualincash_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Dim pos_last2 As Integer : Dim endofstring_last As String = ","
pos_last2 = InStr(1, annualincash_txt.Text, endofstring_last)
On Error Resume Next
annualincash_txt.SelectionStart = pos_last2 - 1
annualincash_txt.SelectionLength = 10
annualincash_txt.Cut()
annualincash_txt.Update()
incomekind()
End Sub
Public Sub incomekind()
Dim pos_last1 As Integer : Dim startofstring_last As String = Label47.Text
pos_last1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, startofstring_last)
Data_Update_Controls.SourceView_txtbox.SelectionStart = pos_last1 + (Label47.Text.Length - 1)
Data_Update_Controls.SourceView_txtbox.SelectionLength = 4
annualinkind_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Dim pos_last2 As Integer : Dim endofstring_last As String = ","
pos_last2 = InStr(1, annualinkind_txt.Text, endofstring_last)
On Error Resume Next
annualinkind_txt.SelectionStart = pos_last2 - 1
annualinkind_txt.SelectionLength = 20
annualinkind_txt.Cut()
annualinkind_txt.Update()
SSS()
End Sub
Public Sub SSS()
Dim zone1 As Integer : Dim zone As String = Label48.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label48.Text.Length - 1)
.SelectionLength = 1
End With
SSSGSIS_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
SSSGSIS_txt.Update()
water()
End Sub
Public Sub water()
Dim zone1 As Integer : Dim zone As String = Label49.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label49.Text.Length - 1)
.SelectionLength = 1
End With
watersource_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
watersource_txt.Update()
toilet()
End Sub
Public Sub toilet()
Dim zone1 As Integer : Dim zone As String = Label50.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label50.Text.Length - 1)
.SelectionLength = 1
End With
toilettype_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
toilettype_txt.Update()
tenure()
End Sub
Public Sub tenure()
Dim zone1 As Integer : Dim zone As String = Label51.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label51.Text.Length - 1)
.SelectionLength = 1
End With
tenurestatus_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
tenurestatus_txt.Update()
rent()
End Sub
Public Sub rent()
Dim zone1 As Integer : Dim zone As String = Label52.Text
zone1 = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, zone)
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = zone1 + (Label52.Text.Length - 1)
.SelectionLength = 4
End With
rent_txt.Text = Data_Update_Controls.SourceView_txtbox.SelectedText
Dim Lon_end As Integer : Dim endstr As String = ","
Lon_end = InStr(1, rent_txt.Text, endstr)
With rent_txt
.SelectionStart = Lon_end - 1
.SelectionLength = 10
.Cut()
.Update()
End With
End Sub
Public Sub Readme()
Dim str_start As Integer
str_start = InStr(1, Data_Update_Controls.SourceView_txtbox.Text, startstr)
If str_start > 0 Then
With Data_Update_Controls.SourceView_txtbox
.SelectionStart = str_start + (sellength - 1)
.SelectionLength = 40
.Copy()
End With
End If
End Sub
Private Sub SourceList_lst_SelectedIndexChanged(sender As Object, e As EventArgs) Handles SourceList_lst.SelectedIndexChanged
Data_Update_Controls.DisplayContents()
GPS_lat()
End Sub
Private Sub ShowMap_btn_Click(sender As Object, e As EventArgs)
Me.Close()
GoCopy()
Startup.Show()
End Sub
Private Sub GoCopy()
Try
System.IO.File.Copy("HPQ2014(Temp).accdb", "C:\CBMSDatabase\HPQ2014(Temp).accdb")
Catch ex As Exception
If MessageBox.Show(ex.Message.ToString(), _
"Error", MessageBoxButtons.YesNo) = vbYes Then
System.IO.File.Delete("C:\CBMSDatabase\HPQ2014(Temp).accdb")
System.IO.File.Copy("HPQ2014(Temp).accdb", "C:\CBMSDatabase\HPQ2014(Temp).accdb")
End If
End Try
End Sub
Private Sub Reload()
If System.IO.File.Exists("HPQ2014(Temp).accdb") = True Then
System.IO.File.Delete("HPQ2014(Temp).accdb")
End If
Try
System.IO.File.Copy("C:\CBMSDatabase\HPQ2014(Temp).accdb", "HPQ2014(Temp).accdb")
Catch ex As Exception
MessageBox.Show(ex.Message.ToString(), "Error")
End Try
End Sub
End Class
And here is the file that i'm importing to my database..
{"androidDisplayName":"ADELINA BRUCE RO","androidDescription":"05 17 4 018 99 356","geopoint_hh_ind":"1","geopoint_hh":{"latitude":"13.354465000000001","longitude":"123.73282666666667","altitude":"38.1","accuracy":"4.8"},"regn":"05","prov":"05","mun":"17","zone":"4","brgy":"018","purok":"99","street":"none","hnum":"none","hcn":356,"respondent":"ADELINA BRUCE","int_date":"2014-06-13","start_time":"14:00","interviewer":"RONALD BONAFUS","house_type":"1","house_type_o":"","nbr":1,"roof":"2","wall":"2","nofw":0,"nnucfam":1,"hpregind":"2","uniparind":"1","disableind":"2","phsize":1,"hpq_mem":[{"memno":"1","msname":"BRUCE ","mfname":"ADELINA","mmname":"BA\u00d1ADERA","nucfam":"1","reln":"1","reln_o":"","sex":"2","birth_date":"1943-12-10","age":70.5927446954141,"age_yr":70,"birth_reg":"1","civstat":"3","ethgrp":"37","ethgrp_o":"","ofw":null,"mlenresid":"1","country_resid":"","country_resid_o":"","prov_resid_code":"","mun_resid_code":"","brgy_resid_code":"","mun_resid_txt":"","brgy_resid_txt":"","educind":"2","gradel":"","sch_type":"","gradel_calc":499,"ynotsch":"","ynotsch_o":"","educal":"16","psced7":"","course_o":"","literind":"1","regvotind":"1","voted_last_election":"2","jobind":"2","entrepind":"2","njob":0,"occup":"","psoc4":"","indust":"","psic4":"","jstatus":"","work_ddhrs":0,"work_wkhrs":0,"fadd_work_hrs":null,"fxtra_wrk":null,"workcl":"","fjob":"2","first_fjob":null,"jsearch_meth":"","jsearch_meth_o":"","wks_fjob":0,"ynotlookjob":"3","ynotlookjob_o":"","lastlookjob":"3","joppind":"2","wtwind":"2","wagcshm":0,"wagkndm":0,"sss_ind":"4","pregind":null,"solo_parent":"1","pwd_ind":null,"pwd_type":"","pwd_type_o":"","pwd_id":null,"scid_ind":"1","mcrimeind":"2","mtheftind":null,"mrapeind":null,"minjurind":null,"mcarnapind":null,"mcattrustlind":null,"mocrimind":null,"mocrim":"","mtheftloc":null,"mrapeloc":null,"minjurloc":null,"mcarnaploc":null,"mcattrustlloc":null,"mocrimloc":null,"mnutind":"","mnutind_date":""}],"water":"2","water_o":"","water_dist":10,"toil":"1","toil_o":"","tenur":"1","tenur_o":"","imprnt":500,"welec":"1","elec_company":"1","elec_generator":"2","elec_solar":"2","elec_battery":"2","elec_source_o":"2","elec_source_o_lb":"","radio":0,"radio_nwacq":0,"tv":0,"tv_nwacq":0,"vplayer":0,"vplayer_nwacq":0,"stereo":0,"stereo_nwacq":0,"karaoke":0,"karaoke_nwacq":0,"ref":0,"ref_nwacq":0,"efan":0,"efan_nwacq":0,"iron":0,"iron_nwacq":0,"stove":0,"stove_nwacq":0,"wmach":0,"wmach_nwacq":0,"microw":0,"microw_nwacq":0,"computer":0,"computer_nwacq":0,"internet":0,"internet_nwacq":0,"celfone":0,"celfone_nwacq":0,"telefone":0,"telefone_nwacq":0,"airc":0,"airc_nwacq":0,"sewmach":0,"sewmach_nwacq":0,"car":0,"car_nwacq":0,"motor":0,"motor_nwacq":0,"landagri":0,"landagri_nwacq":0,"landres":0,"landres_nwacq":0,"landcomm":0,"landcomm_nwacq":0,"sofa":1,"sofa_nwacq":0,"dineset":1,"dineset_nwacq":0,"own_other":0,"own_other_o":"","own_other_nwacq":0,"insur_house":"2","insur_house_src":"","insur_house_src_o":"","insur_motor":null,"insur_motor_src":"","insur_motor_src_o":"","insur_appliance":"2","insur_appliance_src":"","insur_appliance_src_o":"","garb_collect":"1","garb_burn":"2","garb_comp":"2","garb_recycl":"2","garb_wsegr":"2","garb_cpit":"2","garb_opit":"2","garb_river":"2","garb_mgt_o":"2","garb_mgt_o_lb":"","garb_collector":"1","garb_collector_o":"","freq_garb_coll":"2","freq_garb_coll_o":"","cropind":"2","cropincsh":0,"cropinknd":0,"poultind":"2","pouincsh":0,"pouinknd":0,"fishind":"2","fishincsh":0,"fishinknd":0,"forind":"2","forincsh":0,"forinknd":0,"salind":"2","salincsh":0,"salinknd":0,"manind":"2","manincsh":0,"maninknd":0,"servind":"2","servincsh":0,"servinknd":0,"trnind":"2","trnincsh":0,"trninknd":0,"minind":"2","minincsh":0,"mininknd":0,"cnsind":"2","cnsincsh":0,"cnsinknd":0,"eothind":"2","eoincsh":0,"eoinknd":0,"etotcsh":0,"etotknd":0,"wagcsh":0,"wagknd":0,"agscsh":0,"agsknd":0,"ofwcsh":0,"ofwknd":0,"supfcsh":0,"supfknd":0,"suprcsh":12000,"suprknd":500,"rentvcsh":0,"rentvknd":0,"intrcsh":0,"intrknd":0,"pencsh":0,"penknd":0,"divcsh":0,"divknd":0,"othscsh":0,"othsknd":0,"othstotcsh":12000,"othstotknd":500,"imprnttot":6000,"totincsh":12000,"totinknd":6500,"totin":18500,"nalp":0,"hpq_alp":[],"ncrop":0,"hpq_crop":[],"agriequip1":null,"agriequip1_nown":0,"agriequip2":null,"agriequip2_nown":0,"agriequip3":null,"agriequip3_nown":0,"agriequip4":null,"agriequip4_nown":0,"agriequip5":null,"agriequip5_nown":0,"agriequip6":null,"agriequip6_nown":0,"agriequip7":null,"agriequip7_nown":0,"agriequip8":null,"agriequip8_nown":0,"agriequip9":null,"agriequip9_nown":0,"agriequip10":null,"agriequip10_nown":0,"agriequip11":null,"agriequip11_nown":0,"agriequip12":null,"agriequip12_nown":0,"agriequip13":null,"agriequip13_nown":0,"agriequip14":null,"agriequip14_nown":0,"agriequip15":null,"agriequip15_nown":0,"agriequip16":null,"agriequip16_nown":0,"agriequip17":null,"agriequip17_nown":0,"agriequip18":null,"agriequip18_nown":0,"agriequip18_o":"","live_a_hog":null,"live_a_hog_vol":0,"live_a_goat":null,"live_a_goat_vol":0,"live_a_carabao":null,"live_a_carabao_vol":0,"live_a_cow":null,"live_a_cow_vol":0,"live_a_chicken":null,"live_a_chicken_vol":0,"live_a_duck":null,"live_a_duck_vol":0,"live_a_others":null,"live_a_others_o":"","live_a_others_vol":0,"meat_hog":null,"meat_hog_vol":0,"meat_goat":null,"meat_goat_vol":0,"meat_carabao":null,"meat_carabao_vol":0,"meat_cow":null,"meat_cow_vol":0,"meat_chicken":null,"meat_chicken_vol":0,"meat_duck":null,"meat_duck_vol":0,"meat_others":null,"meat_others_o":"","meat_others_vol":0,"milk_goat":null,"milk_goat_vol":0,"milk_carabao":null,"milk_carabao_vol":0,"milk_cow":null,"milk_cow_vol":0,"milk_others":null,"milk_others_o":"","milk_others_vol":0,"egg_chicken":null,"egg_chicken_vol":0,"egg_duck":null,"egg_duck_vol":0,"egg_others":null,"egg_others_o":"","egg_others_vol":0,"oani_ind":null,"oani_txt":"","oani_hog":null,"oani_hog_vol":0,"oani_goat":null,"oani_goat_vol":0,"oani_carabao":null,"oani_carabao_vol":0,"oani_cow":null,"oani_cow_vol":0,"oani_chicken":null,"oani_chicken_vol":0,"oani_duck":null,"oani_duck_vol":0,"oani_others":null,"oani_others_o":"","oani_others_vol":0,"catch_fish":null,"cul_fish":null,"catch_fish_loc":null,"boat1":null,"boat1_own":null,"boat2":null,"boat2_own":null,"boat3":null,"boat3_own":null,"boat4":null,"boat4_own":null,"boat5":null,"boat5_own":null,"naquaequip":0,"hpq_aquaequip":[],"fishpond":null,"fishpen":null,"fishcage":null,"seaweedfarm":null,"oysterfarm":null,"musselfarm":null,"fishtank":null,"hatchery":null,"aquafarm_o":null,"aquafarm_o_txt":"","naquani":0,"hpq_aquani":[],"maxyr_resid":"1","yrs_in_cropind":null,"u_amt_harv":null,"u_low_harv":"","u_low_harv_o_lb":"","u_chng_scrop":null,"u_chng_scrop_y":"","u_chng_scrop_y_o_lb":"","u_chng_pcrop":null,"u_chng_pcrop_y":"","u_chng_pcrop_y_o_lb":"","irfa_crop":null,"irfa_crop_src":"","irfa_crop_src_o":"","irfa_agriequip":null,"irfa_agriequip_src":"","irfa_agriequip_src_o":"","yrs_in_lstockind":null,"u_amt_lve":null,"u_low_lve":"","u_low_lve_o_lb":"","irfa_anim":null,"irfa_anim_src":"","irfa_anim_src_o":"","yrs_in_fishind":null,"u_amt_fish":null,"u_low_fish":"","u_low_fish_o_lb":"","irfa_fish":null,"irfa_fish_src":"","irfa_fish_src_o":"","temp_humid":"1","elec_loss":"1","sea_level":"2","water_supply":"2","low_wsupp":"","low_wsupp_o_lb":"","flood_freq":"2","flood_duration":0,"flood_duration_12":0,"drought":"2","drought_duration":"","evac_mveout":"1","evac_ymveout":"1","evac_ymveout_o":"","evac_trans":"1","evac_cntr":"4","evac_cntr_o_lb":"","calam1":"1","calam1_hwmny":1,"calam1_aid":"1","calam1_hus_aid":"1","calam1_hus_aid_o":"","calam2":"2","calam2_hwmny":0,"calam2_aid":null,"calam2_hus_aid":"","calam2_hus_aid_o":"","calam3":"2","calam3_hwmny":0,"calam3_aid":null,"calam3_hus_aid":"","calam3_hus_aid_o":"","calam4":"2","calam4_hwmny":0,"calam4_aid":null,"calam4_hus_aid":"","calam4_hus_aid_o":"","calam5":"2","calam5_hwmny":0,"calam5_aid":null,"calam5_hus_aid":"","calam5_hus_aid_o":"","calam6":"2","calam6_hwmny":0,"calam6_aid":null,"calam6_hus_aid":"","calam6_hus_aid_o":"","calam7":"2","calam7_hwmny":0,"calam7_aid":null,"calam7_hus_aid":"","calam7_hus_aid_o":"","calam8":"2","calam8_hwmny":0,"calam8_aid":null,"calam8_hus_aid":"","calam8_hus_aid_o":"","calam9":"2","calam9_hwmny":0,"calam9_aid":null,"calam9_hus_aid":"","calam9_hus_aid_o":"","calam10":"2","calam10_hwmny":0,"calam10_aid":null,"calam10_hus_aid":"","calam10_hus_aid_o":"","calam11":"2","calam11_o":"","calam11_hwmny":0,"calam11_aid":null,"calam11_hus_aid":"","calam11_hus_aid_o":"","disas_prep":"2","dp_kit1":null,"dp_kit1_xpiry":0,"dp_kit2":null,"dp_kit2_xpiry":0,"dp_kit3":null,"dp_kit4":null,"dp_kit5":null,"dp_kit6":null,"dp_kit7":null,"dp_kit8":null,"dp_kit9":null,"dp_kit10":null,"dp_kit11":null,"dp_kit12":null,"dp_kit13":null,"dp_kit13_o":"","dp_kit13_xpiry":0,"fshort":"2","fsmonth_1":"","fsdays_1":0,"fsmonth_2":"","fsdays_2":0,"fsmonth_3":"","fsdays_3":0,"prevmind":"2","ndeath":0,"hpq_death":[],"prog_slp":"2","prog_slp_nmem":0,"hpq_slp_mem":[],"prog_slp_impl":"","prog_slp_impl_o":"","prog_fudforsch":"2","prog_fudforsch_nmem":0,"hpq_fudforsch_mem":[],"prog_fudforsch_impl":"","prog_fudforsch_impl_o":"","prog_fudforwrk":"2","prog_fudforwrk_nmem":0,"hpq_fudforwrk_mem":[],"prog_fudforwrk_impl":"","prog_fudforwrk_impl_o":"","prog_cshforwrk":"2","prog_cshforwrk_nmem":0,"hpq_cshforwrk_mem":[],"prog_cshforwrk_impl":"","prog_cshforwrk_impl_o":"","prog_spisc":"2","prog_spisc_nmem":0,"hpq_spisc_mem":[],"prog_spisc_impl":"","prog_spisc_impl_o":"","prog_cct":"2","prog_cct_nmem":0,"hpq_cct_mem":[],"prog_cct_impl":"","prog_cct_impl_o":"","prog_arcdp":"2","prog_arcdp_nmem":0,"hpq_arcdp_mem":[],"prog_arcdp_impl":"","prog_arcdp_impl_o":"","prog_cbep":"2","prog_cbep_nmem":0,"hpq_cbep_mem":[],"prog_cbep_impl":"","prog_cbep_impl_o":"","prog_phiheal_ofw":"2","prog_phiheal_ofw_nmem":0,"hpq_phiheal_ofw_mem":[],"prog_phiheal_empl":"2","prog_phiheal_empl_nmem":0,"hpq_phiheal_empl_mem":[],"prog_phiheal_indiv":"2","prog_phiheal_indiv_nmem":0,"hpq_phiheal_indiv_mem":[],"prog_phiheal_spon":"2","prog_phiheal_spon_nmem":0,"hpq_phiheal_spon_mem":[],"prog_phiheal_spon_impl":"","prog_phiheal_spon_impl_o":"","prog_phiheal_life":"2","prog_phiheal_life_nmem":0,"hpq_phiheal_life_mem":[],"nprog":1,"hpq_prog":[{"prog_line":"1404302501310","progtype":"22","progname":"MUNTING HANDOG PROGRAM","prognmem":1,"hpq_prog_mem":[{"hpq_prog_mem_refno":"1"}],"progimplementor":"3","progimplementor_o":""}],"end_time":"14:00","supervisor":"MARY GRACE CASAUL"}