|
-
Jan 1st, 2012, 07:45 AM
#1
Thread Starter
New Member
2vb questions
1.prompt a text string in 0 to 20 characters and then pass it as a input parameter to a Boolean-valued Function to check if the string is symmetric (對稱) or not. Display the result.
2.The Einstein’s equation E=mc2 relates three variables, E, m, and c. create four TextBoxes, two for the names of variables (E, m, c) and the other two for the values of corresponding variables. Based on the entered names and values, calculate and display the unknown variable in another TextBox.
how to do?
-
Jan 1st, 2012, 07:49 AM
#2
Re: 2vb questions
We can help you but we're not here to just do your homework for you. That would be cheating. So, what have you done in an effort to answer these assignment questions and where exactly are you having problems? If you have no idea at all then I suggest that you look back over your notes/text because you will obviously have been provided with the a good portion of the required information so you need to make use of it.
-
Jan 2nd, 2012, 05:01 AM
#3
Re: 2vb questions
1. use the StrReverse function and compare the original string to that ... if it is the same then it is symmetric.
2. this is really basic ... why don't you try it and tell us what you get stuck on if you get stuck.
Kris
-
Jan 2nd, 2012, 05:40 AM
#4
Thread Starter
New Member
Re: 2vb questions
Dim Str As String
Private Sub Command1_Click()
Str = Text1
Text2 = StrReverse(Str)
If Text1 = Text2 Then
MsgBox "Right"
Else
MsgBox "Wrong"
End If
End Sub
Private Sub Form_Load()
Text1 = ""
Text2 = ""
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And (KeyAscii < Asc("a") Or KeyAscii > Asc("z")) And (KeyAscii < Asc("A") Or KeyAscii > Asc("Z")) ThenKeyAscii = 0
End If
End Sub
-
Jan 2nd, 2012, 06:17 AM
#5
Re: 2vb questions
That's VB6 code. Are you actually using VB6 or VB.NET?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|