Results 1 to 5 of 5

Thread: 2vb questions

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    2

    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?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390

    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

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    2

    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

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: 2vb questions

    That's VB6 code. Are you actually using VB6 or VB.NET?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width