The objective of this code is simple. It is the part of a bible problems software which stores verses, problems, book name, chapter and verse number. By pressing the first button, data is saved. But if that verse is already present, only one out of two times it prompts the user. Why? And with the second button we should be able to retrieve any verse. But it only shows the last saved verse. For the rest it shows an error.
Dim tbw, pyob, sylu, vyrs, ch, vyrsn, byok As String
Dim bk, cr As String
pyob = problem.Text
sylu = solution.Text
vyrs = Verse.Text
ch = cha.Text
vyrsn = ver.Text
byok = book.Text
If byok = "" Then
MsgBox("please select a book", MsgBoxStyle.Exclamation)
GoTo hurrah
End If
Dim ddd, rabbi1, rabbi2 As String
If Val(ch) %26lt;= 0 Or Val(vyrsn) %26lt;= 0 Then
MsgBox("The chapter and verse has to be a number %26gt; 0", vbExclamation)
Else
Dim tbr As String = My.Computer.FileSystem.ReadAllText("c:\p... files\bibprobs\savedprobs\saveo.txt")
Dim zx As Integer = 1
Dim chance, sos As Integer
Dim lengthop, x As Integer
Dim dve As String
start:
ddd = Trim(Mid(tbr, zx, 10))
If ddd = "@@##$$#$♂♥" Then
sos = zx
GoTo book
Else
Do While ddd %26lt;%26gt; "@@##$$#$♂♥" = True And x %26lt; 599 = True
lengthop = lengthop + 1
x = x + 1
ddd = Trim(Mid(tbr, zx + lengthop, 10))
Loop
If ddd %26lt;%26gt; "@@##$$#$♂♥" Then
GoTo notfoundaa
Else
zx = zx + lengthop
GoTo book
End If
End If
book:
zx = zx + 10
Do While Mid(tbr, zx + lengthop, 10) %26lt;%26gt; "☻◊■□ℓℓℓ℅€‼" = True
lengthop = lengthop + 1
Loop
bk = Mid(tbr, zx, lengthop)
If byok = bk Then chance = chance + 1
zx = zx + lengthop + 10
lengthop = 0
Do While Mid(tbr, zx + lengthop, 10) %26lt;%26gt; "⅜⅛⅞⅝¶¶¶¶¶¶" = True
lengthop = lengthop + 1
Loop
cr = Trim$(Mid(tbr, zx, lengthop))
If ch = cr Then chance = chance + 1
zx = zx + lengthop + 10
lengthop = 0
Do While Mid(tbr, zx + lengthop, 10) %26lt;%26gt; "♀♀♀♀☻☻☻☻Ωq" = True
lengthop = lengthop + 1
Loop
dve = Trim$(Mid(tbr, zx, lengthop))
If dve = vyrsn Then chance = chance + 1
If chance = 3 Then
GoTo searchedwell
Else
zx = zx + 10 + lengthop
lengthop = 0
Do While Mid(tbr, zx + lengthop, 10) %26lt;%26gt; "®©w¤°§§«»s" = True
lengthop = lengthop + 1
Loop
zx = zx + 10 + lengthop
lengthop = 0
Do While Mid(tbr, zx + lengthop, 10) %26lt;%26gt; "░kbbccc3^░" = True
lengthop = lengthop + 1
Loop
zx = zx + lengthop + 10
lengthop = 0
GoTo start
End If
searchedwell:
MsgBox("This problem already exists. are you sure you want to overwright it?", vbYesNo + vbExclamation)
If vbYes Then
rabbi1 = Mid(tbr, 1, sos)
rabbi2 = Mid(tbr, zx)
tbw = rabbi1 + rabbi2 + "@@##$$#$♂♥" + byok + "☻◊■□ℓℓℓ℅€‼" + ch + "⅜⅛⅞⅝¶¶¶¶¶¶" + vyrsn + "♀♀♀♀☻☻☻☻Ωq" + vyrs + "®©w¤°§§«»s" + pyob + "ææææææçççç" + sylu + "░kbbccc3^░"
My.Computer.FileSystem.WriteAllText("c:\... files\bibprobs\savedprobs\saveo.txt", tbw, False)
GoTo hurrah
Else
GoTo hurrah
End If
notfoundaa:
tbw = "@@##$$#$♂♥" + byok + "☻◊■□ℓℓℓ℅€‼" + ch + "⅜⅛⅞⅝¶¶¶¶¶¶" + vyrsn + "♀♀♀♀☻☻☻☻Ωq" + vyrs + "®©w¤°§§«»s" + pyob + "ææææææçççç" + sylu + "░kbbccc3^░"
My.Computer.FileSystem.WriteAllText("c:\... files\bibprobs\savedprobs\saveo.txt", tbw + tbr, False)
GoTo hurrah
hurrah:
End If
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If My.Computer.FileSystem.DirectoryExists("... Files\bibprobs\savedprobs") = False Then My.Computer.FileSystem.CreateDirectory("... Files\bibprobs\savedprobs")
Dim bk, cr, ve, sn, pm, tbr, dbk, dcr, dve, dverse, ddd As String
Dim x, intmsg, zx, lengthop, chance As Integer
zx = 1
bk = book.Text
cr = cha.Text
ve = ver.Text
If bk = "" Then
MsgBox("please select a book.", MsgBoxStyle.Exclamation)
GoTo Ending
End If
If Val(ve) = 0 Or Val(cr) = 0 Then
intmsg = MsgBox("The verse or the chapter cannot be a string or equal to zero.", vbExclamation)
GoTo Ending
Else
tbr = My.Computer.FileSystem.ReadAllText("c:\P... Files\bibprobs\savedprobs\saveo.txt")
start: If Trim(Mid(tbr, zx, 10)) = "@@##$$#$♂♥" = True Then
ddd = Mid(tbr, zx, 10)
Else
Do
x = x + 1
lengthop = lengthop + 1
Loop While x %26lt; 9000 = True And Trim(Mid(tbr, zx + lengthop, 10)) %26lt;%26gt; "@@##$$#$♂♥" = True
ddd = Mid(zx + lengthop, 10)
zx = zx + lengthop
lengthop = 0
End If
If ddd = "@@##$$#$♂♥" = True Then GoTo book Else GoTo notfoundaa
book:
zx = zx + 10
Do While Trim(Mid(tbr, zx + lengthop, 10)) %26lt;%26gt; "☻◊■□ℓℓℓ℅€‼" = True
lengthop = lengthop + 1
Loop
dbk = Mid(tbr, zx, lengthop)
If dbk = bk Then chance = chance + 1
zx = zx + lengthop + 10
lengthop = 0
Do While Mid(tbr, zx + lengthop, 10) %26lt;%26gt; "⅜⅛⅞⅝¶¶¶¶¶¶" = True
lengthop = lengthop + 1
Loop
dcr = Trim$(Mid(tbr, zx, lengthop))
If dcr = cr Then chance = chance + 1
zx = zx + lengthop + 10
lengthop = 0
Do While Trim(Mid(tbr, zx + lengthop, 10)) %26lt;%26gt; "♀♀♀♀☻☻☻☻Ωq" = True
lengthop = lengthop + 1
Loop
dve = Trim$(Mid(tbr, zx, lengthop))
If dve = ver.Text Then chance = chance + 1
If chance = 3 Then
GoTo searchedwell
Else
Do While Mid(tbr, zx + lengthop, 10) %26lt;%26gt; "░kbbccc3^░" = True
lengthop = lengthop + 1
Loop
zx = zx + lengthop + 10
lengthop = 0
GoTo start
End If
searchedwell:
zx = zx + 10 + lengthop
lengthop = 0
Do While Mid(tbr, zx + lengthop, 10) %26lt;%26gt; "®©w¤°§§«»s" = True
lengthop = lengthop + 1
Loop
dverse = Mid(tbr, zx, lengthop)
Verse.Text = dverse
zx = zx + 10 + lengthop
lengthop = 0
Do While Mid(tbr, zx + lengthop, 10) %26lt;%26gt; "ææææææçççç" = True
lengthop = lengthop + 1
Loop
pm = Mid(tbr, zx, lengthop)
problem.Text = pm
zx = zx + 10 + lengthop
lengthop = 0
Do While Mid(tbr, zx + lengthop, 10) %26lt;%26gt; "░kbbccc3^░" = True
lengthop = lengthop + 1
Loop
sn = Mid(tbr, zx, lengthop)
solution.Text = pm
GoTo Ending
notfoundaa:
MsgBox("The verse was not found. You can search for the problem and save it yourself.", MsgBoxStyle.Critical)
Ending:
End If
Visual Basic 2005 code problem. Urgent help required.Pleeeease help.?
Sub TOBE
Selection.TypeText:="What is the problem?"
End Sub
Reply:Try this.
Reply:Describe the problem at least.
If you r stuck with something in your code you can send it to me at
addmyself@gmail.com
I would be glad to help you out
Reply:What is ur problem???
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment