| | |
BobCat Motors Solution
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2007
Posts: 89
Reputation:
Solved Threads: 0
hey all. the program is for Chapter 8 Lesson C in the Visual Basic 2005
below is code where i have to create a program that allows the user to enter a 4-digit number that identifies whether the salesperson is full or part time.
"Each salesperson at BobCat Motors is assigned an ID number, which consists of four characters. The first character is either the letter F or the letter P. The letter F indicates that the salesperson is a full-time employee. The letter P indicates that he or she is a part-time employee. The middle two characters are the salesperson's initials, and the last character is either a 1 or a 2. A 1 indicates that the salesperson sells new cars, and a 2 indicates that the salesperson sells used cars.
I know what I want to do...just kinda stuck on making it happen. I'm thinking I may need a Do While structure for the F and P but iono.
Help?
below is code where i have to create a program that allows the user to enter a 4-digit number that identifies whether the salesperson is full or part time.
"Each salesperson at BobCat Motors is assigned an ID number, which consists of four characters. The first character is either the letter F or the letter P. The letter F indicates that the salesperson is a full-time employee. The letter P indicates that he or she is a part-time employee. The middle two characters are the salesperson's initials, and the last character is either a 1 or a 2. A 1 indicates that the salesperson sells new cars, and a 2 indicates that the salesperson sells used cars.
VB.NET Syntax (Toggle Plain Text)
Private Sub xCalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCalcButton.Click 'variables Dim strInput As String = "" Dim str1stCharacter As String = "" Dim strlstCharacter As String Dim strOutput As String = "" Dim fullt As Integer = 0 Dim partt As Integer = 0 Dim newsellcar As Integer = 0 Dim usesellcar As Integer = 0 strInput = Me.xIdTextBox.Text ' changes the id number case to upper strInput = Me.xIdTextBox.Text.ToUpper() ' sets the focus Me.xIdTextBox.Focus() str1stCharacter = Microsoft.VisualBasic.Left(strInput, 1) strlstCharacter = Microsoft.VisualBasic.Left(strInput, 4) If str1stCharacter = "F" And strlstCharacter = "1" Then 'salesperson is fulltime and sells new cars Me.xFulltimeLabel.Text = Me.xNewCarsLabel.Text = CStr(newsellcar) ElseIf str1stCharacter = "F" And strlstCharacter = "2" Then 'salesperson is fulltime and sells used cars Me.xFulltimeLabel.Text = Me.xUsedCarsLabel.Text = ElseIf str1stCharacter = "P" And strlstCharacter = "1" Then 'salesperson is part-time and sells new cars Me.xParttimeLabel.Text = Me.xNewCarsLabel.Text = ElseIf str1stCharacter = "P" And strlstCharacter = "2" Then 'salesperson is part-time and sells used cars Me.xParttimeLabel.Text = Me.xUsedCarsLabel.Text = End If End Sub
I know what I want to do...just kinda stuck on making it happen. I'm thinking I may need a Do While structure for the F and P but iono.
Help?
•
•
Join Date: Jun 2006
Posts: 68
Reputation:
Solved Threads: 8
The code looks valid and it's gonna do what it's supposed to.
You don't need a Do While.
This snippet extracts the first and last character of the string which is then used in the IF statement for comparison.
What, exactly, is it that you want to do and you get stuck on?
You don't need a Do While.
This snippet extracts the first and last character of the string which is then used in the IF statement for comparison.
str1stCharacter = Microsoft.VisualBasic.Left(strInput, 1) strlstCharacter = Microsoft.VisualBasic.Left(strInput, 4) What, exactly, is it that you want to do and you get stuck on?
Like Oxiegen said, it should run perfectly but don't forget to finish the IF statement and fill the equal sign to do what it should ie.
Also you don't need to write "Me." infront because its already assumed that its like that.
VB Syntax (Toggle Plain Text)
Me.xFulltimeLabel.Text = "Full-Time: True"
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: FileNotFoundException
- Next Thread: display output prompted by radio button
Views: 1106 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application array arrays basic bing button buttons c# center check checkbox code convert crystalreport data database datagrid datagridview date design designer dissertation dissertations dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images inline input insert installer intel internet listview mobile monitor net networking objects output panel passingparameters picturebox port position print printing problem read remove save searchbox searchvb.net select serial shutdown soap sorting studio survey table tcp temperature text textbox time timer timespan toolbox trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet visual visualbasic visualbasic.net visualstudio2008 web webbrowser winforms wpf year





