Georgestef 0 Newbie Poster

I am using visual basic 2005 in visual studio 2005. When I try to input unicode data from a sequential txt file using (LineInput(#)) I get question marks eg. (?????? ?????) for all the unicode characters (in this case TNR Greek) in the line, or the command, LineInput(#) doesn't work at all. I am looking for code to allow me to read such line from a txt file. Depending on how I create the file the unicode characters will or will not properly display in MS Notepad. In either case the code I am trying to use does not work. Here is the code I am currently using:

Public Class ReadData
Private Sub GetVariable(ByVal Delimit As String, ByRef L As String, ByRef V As String)
Dim Ld As Integer
'Find Delimiter
Ld = InStr(L, Delimit) - 1
If Ld < 0 Then
Ld = Len(L)
End If
'Extract String Value
V = Mid(L, 1, Ld)
'Shorten Line
L = Trim(Mid(L, Ld + 1, Len(L) - Ld))
End Sub


Private Sub btnRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead.Click
Dim HymnIndex(100) As Integer, HymnName(100) As String, VolumeID(100) As Integer, PDFPageNo(100) As Integer
Dim Myline As String, VariableString As String
Dim I As Integer
'set starting value of I the array index)
I = 1
FileOpen(1, Application.StartupPath + "\VelonIndex.txt", OpenMode.Input)
'Read lines until EOF is reached
Do Until EOF(1)
Myline = LineInput(1)
'show the the line of data read in, This command is simply a debugging device
'Remove next line when solution is found
MessageBox.Show(Myline, "Input Line")
'strip off the leading and trailing spaces
Trim(Myline)
'Find HymnIndex in each line as an Integer
Call GetVariable(" ", Myline, VariableString)
HymnIndex(I) = CInt(Val(VariableString))
lstData.Items.Add("Hymn Index = " + CStr(HymnIndex(I)))
'Find HymnName in each line - two spaces are the delimiter
Call GetVariable(" ", Myline, VariableString)
HymnName(I) = Trim(VariableString)
lstData.Items.Add("Hymn Name = " + HymnName(I))
Call GetVariable(" ", Myline, VariableString)
VolumeID(I) = CInt(Val(VariableString))
lstData.Items.Add("Volume ID = " + CStr(VolumeID(I)))
Call GetVariable(" ", Myline, VariableString)
PDFPageNo(I) = CInt(Val(VariableString))
lstData.Items.Add("PDF Page Number = " + CStr(PDFPageNo(I)))
I += 1
Loop
FileClose()
End Sub
End Class

thanks for the help
Georgestef

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.