Description:
Assigining the given string value in Textbox. And on click of Submit button,splitting the
String with ‘/’ and assigning string array. Then creating the datatable with specified columns and
assigning value.
Step 1: Inside the class Employeed details , on page load of the form , datasource for datagrid is
assigned null. This method will execute everytime when the program is called as it is inside page load
event.
During load, if the current request is a postback, control properties are loaded with information
recovered from view state and control state.
Step 2:Declare a string variable and assign the text entered in text box . Split the string with ‘/’
Inputvalue = TxtInput.Text
In the below logic datatable is created with skeleton and the following columns are added .For better
coding standards the table created is assigned as datasource .And the table structure is formed.
Datatable:
In ADO.NET, DataTable objects are used to represent the tables in a DataSet. A DataTable represents
one table of in-memory relational data; the data is local to the .NET-based application in which it
resides, but can be populated from a data source such as Microsoft SQL
Is replicated in datagrid.
Name
Country
Residence as
DataGrid_Input.DataSource = table
table.Columns.Add("Name", GetType(String))
table.Columns.Add("Country", GetType(String))
table.Columns.Add("Residence", GetType(String))
Step 4 : Iterating through ValueExtract and getting the values to table.
Using for loop iterating through the values assigned to Value extract
Temp = vbNull
If counter = 6 Then
counter = 1
End If
'Check for the counter value to extract the particular column value
If (counter = 2) Then
Temp = value
Name = Temp
'Increase the counter value to avoid rechecking the same counter value
counter = counter + 1
ElseIf (counter = 4) Then
Temp = value
Country = Temp
counter = counter + 1
Temp = value
Residence = Temp
End If
counter = 2
counter = 4
counter = 6
End If
Next
Next
DataGrid_Input.DataSource = table
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub