Current location: Hot Scripts Forums » Programming Languages » Visual Basic » need vb.net help


need vb.net help

Reply
  #1 (permalink)  
Old 11-02-03, 07:50 PM
darksoap darksoap is offline
Newbie Coder
 
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
need vb.net help

Private Sub OperationButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles OperationButton.Click
Dim strOperation As String
Dim intFirst, intSecond, intAnswer As Integer
strOperation = InputBox("Enter A (add) or S (subtract):", "Operation", "A")
intFirst = Val(InputBox("First number:", "First"))
intSecond = Val(InputBox("Second number:", "Second"))


I need to know how the string will no that it is a A or B
so I can set it in a if then statment.
Reply With Quote
  #2 (permalink)  
Old 06-04-04, 07:03 AM
j@mie j@mie is offline
Newbie Coder
 
Join Date: Jun 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
here we go

Dim strOperation As String
Dim intFirst, intSecond, intAnswer As Integer
strOperation = InputBox("Enter A (add) or S (subtract):", "Operation", "A")

intFirst = Val(InputBox("First number:", "First"))
intSecond = Val(InputBox("Second number:", "Second"))

Select Case strOperation

Case "A"

'Code to run
intAnswer = intFirst + intSecond
MsgBox(intAnswer)

Case "B"
'Code to run

intAnswer = intFirst - intSecond
MsgBox(intAnswer)

End Select
End Sub

u will have 2 convert stroperation to UPPER or LOWER case as "a" is treated different than "A"

hf
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What ASP.NET supported language do you use? Shane ASP.NET 17 02-15-05 09:22 AM
VB.NET - Show another form? Tesco Windows .NET Programming 11 06-04-04 07:09 AM


All times are GMT -5. The time now is 01:15 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.