473,474 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Convert Simple Liberty Basic to VB.NET

Hi everyone, I could use some help in converting a simple Liberty BASIC
program toa VB.NET 2003 SE program. I have built the simple form with a
label, text box and button, Under the button I have inserted the old
LIberty BASIC code. Now my problem is how to go about making the mod to the
code to fit VB's needs, but not loose the logic as it's sound. What should
I start doing at this point? Many thanks, Basil

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
input "Enter a word: "; s$
For i = Len(s$) To 1 Step -1
s1$ = s1$ + Mid$(s$, i, 1)
Next i
print "Reversed is: "; s1$
If s$ = s1$ Then
Print("The word " + s$ + " is a palindrome")
Else
End If
End Sub
End Class
Nov 21 '05 #1
3 3721
Add a text box to the form to input your word and a label to show your
reversed word. The user can enter his text in the text box and then in the
button.click event for the button, reverse your word (textbox.text) and set
the label.text property to the reversed word.

This should be enough info for you to get started on the right track.

"Basil Fawlty" wrote:
Hi everyone, I could use some help in converting a simple Liberty BASIC
program toa VB.NET 2003 SE program. I have built the simple form with a
label, text box and button, Under the button I have inserted the old
LIberty BASIC code. Now my problem is how to go about making the mod to the
code to fit VB's needs, but not loose the logic as it's sound. What should
I start doing at this point? Many thanks, Basil

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
input "Enter a word: "; s$
For i = Len(s$) To 1 Step -1
s1$ = s1$ + Mid$(s$, i, 1)
Next i
print "Reversed is: "; s1$
If s$ = s1$ Then
Print("The word " + s$ + " is a palindrome")
Else
End If
End Sub
End Class

Nov 21 '05 #2
On 2005-03-19, Basil Fawlty <Ba***************@NOSPAMyahoo.com> wrote:
Hi everyone, I could use some help in converting a simple Liberty BASIC
program toa VB.NET 2003 SE program. I have built the simple form with a
label, text box and button, Under the button I have inserted the old
LIberty BASIC code. Now my problem is how to go about making the mod to the
code to fit VB's needs, but not loose the logic as it's sound. What should
I start doing at this point? Many thanks, Basil

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
input "Enter a word: "; s$
For i = Len(s$) To 1 Step -1
s1$ = s1$ + Mid$(s$, i, 1)
Next i
print "Reversed is: "; s1$
If s$ = s1$ Then
Print("The word " + s$ + " is a palindrome")
Else
End If
End Sub
End Class


Private Function IsPalindrome (ByVal TestString As String)
Dim Temp As String = TestString.ToLower ()
Dim chars() As Char = Temp.ToCharArray ()

Array.Reverse (chars)

Dim Reversed As New String (chars)

Return (Temp = Reversed)
End Function

Private Sub Button1_Click (ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

If (IsPalindrome (TextBox1.Text))
Label1.Text = String.Format ("The word {0} is a palindrome",
TextBox1.Text)
End If
End Sub
--
Tom Shelton [MVP]
Nov 21 '05 #3
"Tom Shelton" <ts******@YOUKNOWTHEDRILLcomcast.net> wrote in message
news:uA**************@TK2MSFTNGP10.phx.gbl...
On 2005-03-19, Basil Fawlty <Ba***************@NOSPAMyahoo.com> wrote:
Hi everyone, I could use some help in converting a simple Liberty BASIC
program toa VB.NET 2003 SE program. I have built the simple form with a
label, text box and button, Under the button I have inserted the old
LIberty BASIC code. Now my problem is how to go about making the mod to
the
code to fit VB's needs, but not loose the logic as it's sound. What
should
I start doing at this point? Many thanks, Basil

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
input "Enter a word: "; s$
For i = Len(s$) To 1 Step -1
s1$ = s1$ + Mid$(s$, i, 1)
Next i
print "Reversed is: "; s1$
If s$ = s1$ Then
Print("The word " + s$ + " is a palindrome")
Else
End If
End Sub
End Class


Private Function IsPalindrome (ByVal TestString As String)
Dim Temp As String = TestString.ToLower ()
Dim chars() As Char = Temp.ToCharArray ()

Array.Reverse (chars)

Dim Reversed As New String (chars)

Return (Temp = Reversed)
End Function

Private Sub Button1_Click (ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

If (IsPalindrome (TextBox1.Text))
Label1.Text = String.Format ("The word {0} is a palindrome",
TextBox1.Text)
End If
End Sub
--
Tom Shelton [MVP]


I'm just not quite getting it... below is the code I'm working with. I've
made sure the properties of each text box has the right (name) to match the
..vb coded values... and I still get compile errors. Based on the code
below, 2 errors;Value of type 'System.Windows.Forms.TextBox' cannot be
converted to 'String' & Value of type 'String' cannot be converted to
'System.Windows.Forms.TextBox' exist. they would be related to the linesof
code: s = InputLine and the ReversedTextBox = s1. I seem to have a
problem with the compiler if I leave the .TextBox items there, and removing
them reduced the number of compiler errors.

I think I'm getting close though. --Basil
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim s As String, i As Integer, s1 As String, PalMsg As String

PalMsg = False

s1 = ""

s = InputLine

For i = Len(s) To 1 Step -1

s1 = s1 & Mid(s, i, 1)

Next i

ReversedTextBox = s1

If UCase(s) = UCase(s1) Then

PalMsg = "The above IS a palindrome"

Else

PalMsg = "The above is NOT a palindrome"

End If

PalMsg = True

End Sub
Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: asj | last post by:
It seems that Microsoft may be slowly phasing away Passport, which had been one of the hyped components of the eroded dotnet hype....bye bye, passport, we hardly knew ye! bwahahahbwahahaha!!!!! ...
2
by: Phil Stanton | last post by:
When designing a new form or report, the Default ForeColor is often something like -2147483640 which is the colour of Windows text (possibly black) and the default backColor is -2147483643...
23
by: Kenneth Osenbroch | last post by:
Hi, I am having trouble translating the following lines of Visual Basic code to C. For iCounter = Len(sReference) To 1 Step -1 iSum = iSum + Val(Mid(sReference, iCounter, 1)) * iMultiplier...
3
by: Mark Kamoski | last post by:
Hi-- What is the difference between Convert.ToString(obj) and CType(obj, String)? (Assume obj is a variable of type Object.) Please advise. Thank you.
7
by: Ish2000 | last post by:
Hello, I've a simple windows application and i want to be able to convert a csv file to xml. So far, i can browse for the csv file from the file structure and display in a textbox. I want to...
0
by: Basil Fawlty | last post by:
Hi everyone, I could use some help in converting a simple Liberty BASIC program toa VB.NET 2003 SE program. I have built the simple form with a label, text box and button, Under the button I...
29
by: Harlin Seritt | last post by:
Hi... I would like to take a string like 'supercalifragilisticexpialidocius' and write it to a file in binary forms -- this way a user cannot read the string in case they were try to open in...
5
by: Camille Petersen | last post by:
I have a rather old VisualBasic program which is included inside an Access *.mdb database. So I guess it is an VisualBasic and not and VBA program. Can I somehow automatically convert it into a...
10
by: =?Utf-8?B?Um95?= | last post by:
What is the way to have best performance to copy a byte to a value such as long? I use BitConverter.ToInt64(binary, offset) But the performace is not good enough. I need to have the best...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.