Barcode parsing - vb.net

For example I have this form:
As you can see I have Barcode textbox, and 6 more textboxes. What I need is a code that will parse my barcode from the textbox and fill in the remaining fields. The parenthesis ie (), and the numbers inside it, have to be deleted.
Here is example of my barcode
(1)CODE1(3)NAME(4)SURNAME(8)CODE2(10)CODE3(12)CODE4
For now I have this code:
Private Sub Barcode_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Barcode.Leave
Dim Duzina As String = Me.Barcode.Text.Length
Dim I As Integer = 0
Dim Slog As String = ""
Dim Rec As String = Me.Barcode.Text
For I = 4 To Duzina
If Rec.Substring(I, 1) = "(" Then
Me.Surname.Text = Slog
Exit For
End If
Slog = Slog + Rec.Substring(I, 0)
Next
End Sub
So when the barcode loads into the first textbox, it should fill up all the other textboxes.

My simple solution
Private Sub Barcode_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Barcode.Leave
Dim codes = barcodeTextBox.Text.Split("("c)
Dim code1 = codes(1).Split(")"c)
Dim name = codes(2).Split(")"c)
Dim surename = codes(3).Split(")"c)
Dim code2 = codes(4).Split(")"c)
Dim code3 = codes(5).Split(")"c)
Dim code4 = codes(6).Split(")"c)
sureNameTextBox.Text = surename(0).ToString()
nameTextBox.Text = name(0).ToString()
code1TextBox.Text = code1(0).ToString()
code2TextBox.Text = code2(0).ToString()
code3TextBox.Text = code3(0).ToString()
code4TextBox.Text = code4(0).ToString()
End Sub
Alternative solution
Private Sub Barcode_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Barcode.Leave
Dim codes = barcodeTextBox.Text.Split("("c)
Dim code1 = codes(1).Split(")"c).FirstOrDefault()
Dim name = codes(2).Split(")"c).FirstOrDefault()
Dim surename = codes(3).Split(")"c).FirstOrDefault()
Dim code2 = codes(4).Split(")"c).FirstOrDefault()
Dim code3 = codes(5).Split(")"c).FirstOrDefault()
Dim code4 = codes(6).Split(")"c).FirstOrDefault()
sureNameTextBox.Text = surename
nameTextBox.Text = name
code1TextBox.Text = code1
code2TextBox.Text = code2
code3TextBox.Text = code3
code4TextBox.Text = code4
End Sub

I have done this in this way
Private Function CitanjeBarkoda() As Boolean
Dim Duzina As String = Me.TextBox8.Text.Length
Dim I As Integer = 0
Dim Slog As String = ""
Dim Rec As String = Me.TextBox8.Text
Dim BrOz As Integer = 0
Dim BrZz As Integer = 0
Dim NizOz As New ArrayList
Dim NizZz As New ArrayList
Dim Slog1 As String = ""
For I = 0 To Duzina - 1
If Rec.Substring(I, 1) = "(" Then
BrOz = BrOz + 1
NizOz.Add(I)
End If
If Rec.Substring(I, 1) = ")" Then
BrZz = BrZz + 1
NizZz.Add(I)
End If
Next
Me.TextBox10.Text = Rec.Substring(NizZz(0) + 1, NizOz(1) - NizZz(0) - 1)
Me.IMEOSOBE = Rec.Substring(NizZz(1) + 1, NizOz(2) - NizZz(1) - 1)
Me.PREZIMEOSOBE = Rec.Substring(NizZz(2) + 1, NizOz(3) - NizZz(2) - 1)
Me.TextBox3.Text = Rec.Substring(NizZz(3) + 1, NizOz(4) - NizZz(3) - 1)
Me.BRKART = Rec.Substring(NizZz(4) + 1, NizOz(5) - NizZz(4) - 1)
Me.TextBox5.Text = Rec.Substring(NizZz(5) + 1, NizOz(6) - NizZz(5) - 1)
return true
End function

Actually, the title is a little misleading. It should be string parsing and not barcode parsing. Anyway, you can try this.
Private Sub Barcode_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Barcode.Leave
Dim pvsBarcodeRAW As String = Trim(Me.Barcode.Text.Length)
Dim voNVC As New System.Collections.Specialized.NameValueCollection
Dim vasCodePairs() As String = Split(pvsBarcodeRAW, "(")
For Each vsCodePair As String In vasCodePairs
vsCodePair = Trim(vsCodePair)
If vsCodePair.Length > 0 Then
Dim vasCodePair() As String = Split(vsCodePair, ")")
If vasCodePair.Length = 2 Then
Select Case vasCodePair(0)
Case 1
voNVC("Code1") = vasCodePair(1)
Case 3
voNVC("Name") = vasCodePair(1)
Case 4
voNVC("SurName") = vasCodePair(1)
Case 8
voNVC("Code2") = vasCodePair(1)
Case 10
voNVC("Code3") = vasCodePair(1)
Case 12
voNVC("Code4") = vasCodePair(1)
End Select
End If
End If
Next
'Now you can do whatever you want with the variables in the voNVC variable.
SurName.Text = voNVC("SurName")
End Sub

Put $I in a Code 39 barcode with keymapping enabled on the scanner. $I will act like a TAB key on the keyboard.
One scan of
CODE1$INAME$ISURNAME$ICODE2$ICODE3$ICODE4
Will populate this:
CODE1
NAME
SURNAME
CODE2
CODE3
CODE4
With that said, Code 39 is not good for long barcodes. You could use QR, but tabs are a bit more complex there, still doable though. You would also need a 2D scanner.

Related

Use String Join in VB.Net

I have TxtGamblerImput.Text = 2 4 6 8 10 how should that work that code? how can use that code in that textbox?
TextBox4.Text = String.Join(" ", myFirstComb)
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
'This your First Combination, maximal widht = element
Dim Content As String = TxtGamblerImput.Text
'This Your Element
Dim Element As Integer = 5
Dim myFirstComb = (From mVal In Content.ToString.Split() Select Convert.ToInt32(mVal)).ToArray
'This Your Result List
Dim MyList As New List(Of String)
Dim myM As Integer = myFirstComb.Length
Dim myPost = myM
For myCnt = myM To 1 Step -1
Dim LastStr = ""
For mycnt3 = 1 To Element
For myCnt2 = myCnt To myM
'If myCnt2 = myM Then MsgBox("T")
Dim myVal = myFirstComb(myCnt2 - 1)
If myVal > Element Then myVal = 1
If Element - myM + myCnt2 = myVal Then
myFirstComb(myCnt2 - 1) = myVal
Else
If (myVal + 1) > Element Then myVal = 0
myFirstComb(myCnt2 - 1) = myVal + 1
End If
Next
Dim Hsl = String.Join(" ", myFirstComb)
If LastStr <> Hsl Then
MyList.Add(Hsl)
End If
LastStr = Hsl
Next
Next
myFirstComb = (From mVal In Content.ToString.Split() Select Convert.ToInt32(mVal))
TextBox4.Text = String.Join(" ", myFirstComb)
End Sub
In that Output: Show 2 4 6 8 10
I dind't work? How can use that code for worked?

vb.net threading sub slower than call sub

I know this Question was already posted, but it was never really answered, or I did not understand the answer :)
My Problem is that when I call this Sub within the Thread, it takes about 4 sec to execute the code, but if I make a simple Call Sub (Like commented in Code) it takes about 450 ms.
I have a simple program with 2 Subs:
To report Progress on Main Form
To do some "For" Looping
Imports System.Data.SqlClient
Public Class Form1
Public Delegate Sub ProzentDelegate(ByVal Prozent As Double)
Dim G_I_Temp As Integer = 0
Dim G_S_Prüfziffer As String
Dim G_S_Präfix As String
Dim G_I_Zähler As Integer
Dim G_I_Stellen As Integer
Dim G_D_Step As Integer = 1
Dim G_I_Position As Integer
Dim DT_G_Prüftabelle As DataTable
Dim DR_G_Prüftabelle As DataRow
Dim thisLock As New Object
Dim conn As String = "Data Source=SR-SQLWVS;Initial Catalog=Barcode;Integrated Security=True"
Dim sourceconn As New SqlConnection(conn)
Dim adap As SqlDataAdapter
Dim cmd As SqlCommand = New SqlCommand("SELECT TOP(10) * FROM dbo.Prüf_Tabelle", sourceconn)
Dim Thrd_preview As Threading.Thread
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sourceconn.Open()
cmd.Connection = sourceconn
End Sub
Public Sub ReportProgress(ByVal Prozent As Double)
ProgressBar1.Value = Prozent
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If RB_Thread.Checked Then
If Thrd_preview IsNot Nothing Then Thrd_preview = Nothing
Thrd_preview = New Threading.Thread(AddressOf DoSomeWork)
Thrd_preview.IsBackground = True
Thrd_preview.Start()
Else
DoSomeWork()
End If
End Sub
Private Sub DoSomeWork()
Dim ds As New DataSet
DT_G_Prüftabelle = ds.Tables.Add("Prüf_Tabelle")
Dim L_I_Counter, L_I_Counter2 As Integer
Dim L_I_Ende As Integer
Dim L_I_Step As Integer
Dim L_I_Nutzen As Integer = 1
L_I_Step = 1
L_I_Ende = Val(TB_Auftrag_neu_Anzahl.Text)
G_I_Stellen = 8
G_S_Prüfziffer = "1"
G_S_Präfix = "00"
If TB_Info_Increment.Text = "" Then TB_Info_Increment.Text = 1
adap = New SqlDataAdapter("SELECT TOP(10) * FROM dbo.Prüf_Tabelle", sourceconn)
adap.FillSchema(DT_G_Prüftabelle, SchemaType.Mapped)
DT_G_Prüftabelle.Rows.Clear()
Dim pre As Date = Now
For L_I_Counter = 1 To (L_I_Ende * L_I_Step) Step L_I_Step
For L_I_Counter2 = 1 To L_I_Nutzen
DR_G_Prüftabelle = DT_G_Prüftabelle.NewRow
DR_G_Prüftabelle.Item("Auftrag_Lfd_nr") = TB_KeyLot.Text
DR_G_Prüftabelle.Item("Position") = G_I_Position
G_I_Position += G_D_Step
DR_G_Prüftabelle.Item("Barcode_soll") = F_Berechnung((Trim(Str(Val(TB_Auftrag_neu_Von.Text) + L_I_Counter - 1))).PadLeft(G_I_Stellen, "0"))
DT_G_Prüftabelle.Rows.Add(DR_G_Prüftabelle)
If ProgressBar1.InvokeRequired Then
ProgressBar1.BeginInvoke(New ProzentDelegate(AddressOf ReportProgress), (L_I_Counter * 100) / (L_I_Ende * L_I_Step))
Else
ReportProgress((L_I_Counter * 100) / (L_I_Ende * L_I_Step))
End If
Next
Next
MsgBox(Now.Subtract(pre).TotalMilliseconds.ToString & " ms.")
End Sub
Function F_Berechnung(ByVal L_Nummer As String) As String
Dim L_B_Gerade As Boolean = False
Dim L_I_Prüfziffer As Integer
Dim L_I_Stellen As Integer
Me.G_I_Temp = 0
Select Case G_S_Prüfziffer
Case "0"
F_Berechnung = L_Nummer
Case "1"
F_Berechnung = G_S_Präfix & Trim(L_Nummer)
Case "2"
F_Berechnung = G_S_Präfix & Trim(L_Nummer)
Case "3"
F_Berechnung = L_Nummer
'
Case "5" '-----Mod 10 gewichtung 31...-----
L_Nummer = G_S_Präfix & Trim(L_Nummer)
L_I_Stellen = Len(L_Nummer)
For Me.G_I_Zähler = L_I_Stellen To 1 Step -1
Me.G_I_Temp += Val(Mid(L_Nummer, Me.G_I_Zähler, 1)) * IIf(L_B_Gerade, 1, 3)
L_B_Gerade = Not L_B_Gerade
Next
L_I_Prüfziffer = IIf(10 - Me.G_I_Temp Mod 10 = 10, 0, 10 - Me.G_I_Temp Mod 10)
F_Berechnung = Trim(L_Nummer) & Trim(Str(L_I_Prüfziffer))
'
Case "6" '-----Mod 10 gewichtung 13...-----
L_Nummer = G_S_Präfix & Trim(L_Nummer)
L_I_Stellen = Len(L_Nummer)
For Me.G_I_Zähler = L_I_Stellen To 1 Step -1
Me.G_I_Temp += Val(Mid(L_Nummer, Me.G_I_Zähler, 1)) * IIf(L_B_Gerade, 3, 1)
L_B_Gerade = Not L_B_Gerade
Next
L_I_Prüfziffer = IIf(10 - Me.G_I_Temp Mod 10 = 10, 0, 10 - Me.G_I_Temp Mod 10)
F_Berechnung = Trim(L_Nummer) & Trim(Str(L_I_Prüfziffer))
'
Case Else
F_Berechnung = L_Nummer
End Select
End Function
I have tried to take out Progress Reporting but the Result is the same.
I hope you have some suggestions or solutions for me. I would be very thankful.
Give these changes a try
Change this
If ProgressBar1.InvokeRequired Then
ProgressBar1.Invoke(New ProzentDelegate(AddressOf ReportProgress), Progr)
Else
ReportProgress(Progr)
End If
to
ReportProgress(Progr)
And change method ReportProgress to
Public Sub ReportProgress(ByVal Prozent As Double)
Me.BeginInvoke(Sub()
ProgressBar1.Value = Prozent
End Sub)
End Sub
See if that makes a difference. The check for InvokeRequired is not needed, the answer is always yes.
Just wanted to report that I found a solution.
The main problem was this line of code in:
DR_G_Prüftabelle.Item("Auftrag_Lfd_nr") = TB_KeyLot.Text
So if I start this Sub from another Thread rather than from a Main Thread, for every single loop it has to go to main thread and to take Paramater from TextBox and to go back in Thread to Loop further.
I took that out, declared a variable at the begining and assigned this TextBox value to it and it works like charm.
Also I took a suggestion from dbasnett to Invoke Reporting every time without If-Else and also the suggestion from Steven Doggart to Report every 100 Loops.
You guys helped a lot. Thanks for that!!

treeview disappeared when i reopen the form

I would like to ask for your help. I am stuck to this for more than two days, I've searched the net but unfortunately got no answer.
I have a program in vb 2008 and a database (SQL Server 2008). I have this form which contains treeview. The items display is selected from the database. When i run the program and open the form the treeview items displayed (at first), but when i closed the form and try to open it again the treeview disappear. I dont know why :( . Why is it disappearing? Can somebody help me please. Thank you.
Below is my code....
#form_load
Private Sub frmProfile_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call conecDB()
Call initCMD()
FillTable()
CreateTree() 'create the treeview node
findNode() 'find and checked the selected nodes that was given to the profile
End Sub
'the functions
Private Sub FillTable()
'tv1.Nodes.Clear()
dtable.Columns.Add("ID", GetType(Integer))
dtable.Columns.Add("NAME", GetType(String))
dtable.Columns.Add("PARENT", GetType(Integer))
dtable.Columns.Add("LEVEL", GetType(Integer))
qSQL = "select mod_id,name,parent,level,sort,mnu_name from module where status='A' and parent!=-1"
With comDB
.CommandText = qSQL
rdDB = .ExecuteReader
End With
Do While rdDB.Read
dtable.Rows.Add(rdDB!mod_id, rdDB!name.ToString(), rdDB!parent)
My.Application.DoEvents()
Loop
For i = 0 To dtable.Rows.Count - 1
Dim ID1 As String = dtable.Rows(i).Item("ID").ToString
dtable.Rows(i).Item("LEVEL") = FindLevel(ID1, 0)
Next
rdDB.Close()
End Sub
Private Function FindLevel(ByVal ID As String, ByRef Level As Integer) As Integer
For i = 0 To dtable.Rows.Count - 1
Dim ID1 As String = dtable.Rows(i).Item("ID").ToString
Dim Parent1 As String = dtable.Rows(i).Item("PARENT").ToString
If ID = ID1 Then
If Parent1 = 0 Then
Return Level
Else
Level += 1
FindLevel(Parent1, Level)
End If
End If
Next
Return Level
End Function
Private Sub CreateTree()
tv1.Nodes.Clear()
Dim MaxLevel1 As Integer = CInt(dtable.Compute("MAX(LEVEL)", ""))
Dim i, j As Integer
For i = 0 To MaxLevel1
Dim Rows1() As DataRow = dtable.Select("LEVEL = " & i)
For j = 0 To Rows1.Count - 1
Dim ID1 As String = Rows1(j).Item("ID").ToString
Dim Name1 As String = Rows1(j).Item("NAME").ToString
'Dim mName As String = Rows1(j).Item("mNAME").ToString
Dim Parent1 As String = Rows1(j).Item("PARENT").ToString
If Parent1 = 0 Then
tv1.Nodes.Add(ID1, Name1)
Else
Dim TreeNodes1() As TreeNode = tv1.Nodes.Find(Parent1, True)
If TreeNodes1.Length > 0 Then
TreeNodes1(0).Nodes.Add(ID1, Name1)
End If
End If
Next
Next
End Sub
Private Sub findNode()
Dim rName As String = String.Empty
Dim b As Boolean = True
qSQL = "select access_id,mnu_name from profile_details where prof_id=" & lblPID.Text & ""
With comDB
.CommandText = qSQL
rdDB = .ExecuteReader
End With
Do While rdDB.Read
rName = rdDB!access_id.ToString()
Try
Dim arr As TreeNode() = tv1.Nodes.Find(rName, b)
For i = 0 To arr.Length - 1
tv1.SelectedNode = arr(i)
tv1.SelectedNode.Checked = True
Next
Catch
MsgBox(Err)
End Try
Loop
rdDB.Close()
End Sub

Reading and writing from a csv file

Structure TownType
Dim Name As String
Dim County As String
Dim Population As Integer
Dim Area As Integer
End Structure
Sub Main()
Dim TownList As TownType
Dim FileName As String
Dim NumberOfRecords As Integer
FileName = "N:\2_7_towns(2).csv"
FileOpen(1, FileName, OpenMode.Random, , , Len(TownList))
NumberOfRecords = LOF(1) / Len(TownList)
Console.WriteLine(NumberOfRecords)
Console.ReadLine()
There are only 12 records in the file but this returns a value of 24 for number of records. How do I fix this?
Contents of csv file:
Town, County,Pop, Area
Berwick-upon-tweed, Nothumberland,12870,468
Bideford, devon,16262,430
Bognor Regis, West Sussex,62141,1635
Bridlington, East Yorkshire,33589,791
Bridport, Dorset,12977,425
Cleethorpes, Lincolnshire,31853,558
Colwyn bay, Conway,30269,953
Dover, Kent,34087,861
Falmouth, Cornwall,21635,543
Great Yarmouth, Norfolk,58032,1467
Hastings, East Sussex,85828,1998
This will read the contents into a collection and you can get the number of records from the collection.
Sub Main()
Dim FileName As String
Dim NumberOfRecords As Integer
FileName = "N:\2_7_towns(2).csv"
'read the lines into an array
Dim lines As String() = System.IO.File.ReadAllLines(FileName)
'read the array into a collection of town types
'this could also be done i a loop if you need better
'parsing or error handling
Dim TownList = From line In lines _
Let data = line.Split(",") _
Select New With {.Name = data(0), _
.County = data(1), _
.Population = data(2), _
.Area = data(3)}
NumberOfRecords = TownList.Count
Console.WriteLine(NumberOfRecords)
Console.ReadLine()
End Sub
Writing to the console would be accomplished with something like:
For Each town In TownList
Console.WriteLine(town.Name + "," + town.County)
Next
Many ways to do that
Test this:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
dim FileName as string = "N:\2_7_towns(2).csv"
Dim Str() As String = System.IO.File.ReadAllLines(filename)
'Str(0) contains : "Town, County,Pop, Area"
'Str(1) contains : "Berwick-upon-tweed, Nothumberland,12870,468"
'Str(2) contains : "Bideford, devon,16262,430"
' etc...
'Sample code for string searching :
Dim Lst As New List(Of String)
Lst.Add(Str(0))
Dim LookingFor As String = "th"
For Each Line As String In Str
If Line.Contains(LookingFor) Then Lst.Add(Line)
Next
Dim Result As String = ""
For Each St As String In Lst
Result &= St & Environment.NewLine
Next
MessageBox.Show(Result)
'Sample code creating a grid :
Dim Grid = New DataGridView
Me.Controls.Add(Grid)
Grid.ColumnCount = Str(0).Split(","c).GetUpperBound(0) + 1
Grid.RowCount = Lst.Count - 1
Grid.RowHeadersVisible = False
For r As Integer = 0 To Lst.Count - 1
If r = 0 Then
For i As Integer = 0 To Lst(r).Split(","c).GetUpperBound(0)
Grid.Columns(i).HeaderCell.Value = Lst(0).Split(","c)(i)
Next
Else
For i As Integer = 0 To Lst(r).Split(","c).GetUpperBound(0)
Grid(i, r - 1).Value = Lst(r).Split(","c)(i)
Next
End If
Next
Grid.AutoResizeColumns()
Grid.AutoSize = True
End Sub

VB.Net Silverlight 5 SQL Entities Searching

Im making a silverlight 5 application and im using RIA WCS services to connect to sql, i can add data,delete data, edit data, and get all data, but the problem is that i need to retrieve a specific record not the whole entity, when i try the following code just nothing happens:
Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
' InitializeComponent()
objctx = New BanksDomainContext
Dim itemType = Branch_NameComboBox.SelectedItem.GetType
Dim pi = itemType.GetProperty(Branch_NameComboBox.DisplayMemberPath)
Dim cbi = pi.GetValue(Branch_NameComboBox.SelectedItem, Nothing).ToString()
Dim BranchName As String = cbi
' Dim query As EntityQuery(Of Branches) = objctx.GetBranchesDetailsQuery(BranchName)
' Dim loadOp As LoadOperation(Of Branches) = Me.objctx.Load(query)
' DataGrid1.ItemsSource = loadOp.Entities
' objctx.Load(query, LoadData, Nothing)
Dim loadOp = Me.objctx.Load(Me.objctx.GetBranchesDetailsQuery(BranchName))
LoadData(loadOp)
End Sub
Private Sub LoadData(lo As LoadOperation)
For Each br As Branches In lo.Entities
AddressTextBlock.Text = br.Address
CoordinatesTextBlock.Text = br.Coordinates
ManagerTextBlock.Text = br.Manager
PhoneTextBlock.Text = br.Phone
FaxTextBlock.Text = br.Fax
Next
End Sub
can someone guide me on how to do it?
The following is the solution to load text boxes from SQL records by selecting the search term from a list box:
Private Sub Branch_NameComboBox_SelectionChanged(sender As System.Object, e As System.Windows.Controls.SelectionChangedEventArgs) Handles Branch_NameComboBox.SelectionChanged
m_PushpinLayer.Children.Clear()
objctx = New BanksDomain
Dim itemType = Branch_NameComboBox.SelectedItem.[GetType]()
Dim pi = itemType.GetProperty(Branch_NameComboBox.DisplayMemberPath)
Dim cbi = pi.GetValue(Branch_NameComboBox.SelectedItem, Nothing).ToString()
Dim BranchName As String = cbi
Dim itemType2 = NameComboBox.SelectedItem.[GetType]()
Dim pi2 = itemType2.GetProperty(NameComboBox.DisplayMemberPath)
Dim cbi2 = pi2.GetValue(NameComboBox.SelectedItem, Nothing).ToString()
Dim BankName As String = cbi2
Dim bb As EntityQuery(Of Branches) = From b In objctx.GetBranchesDetailsQuery(BranchName) Where b.Bank = BankName Select b
Dim res As LoadOperation(Of Branches) = objctx.Load(bb, New Action(Of LoadOperation(Of Branches))(AddressOf GetBeansCompleted), True)
End Sub
Private Sub GetBeansCompleted(args As LoadOperation(Of Branches))
For Each bc As Branches In args.Entities
'
Dim Latitude As Double = bc.Lat
Dim Longitude As Double = bc.Lon
Dim CoO As Location = New Location
CoO.Latitude = Decimal.Parse(Latitude)
CoO.Longitude = Decimal.Parse(Longitude)
Dim BName As String = bc.Branch_Name.ToString
Dim MKColor As Color = GetThisColor(bc.MapKeyColor.ToString)
AddPushPin(BName, CoO, MKColor)
AddressTextBlock.Text = (bc.Address.ToString)
LatTextBlock.Text = (Decimal.Parse(Latitude))
LonTextBlock.Text = (Convert.ToDecimal(Longitude))
ManagerTextBlock.Text = (bc.Manager.ToString)
PhoneTextBlock.Text = (bc.Phone.ToString)
FaxTextBlock.Text = (bc.Fax.ToString)
Next
End Sub