70 likes | 185 Views
Assignment 3 help. Dr. John Abraham Professor UTPA. Declaring variables. Use Option Explicit Dim fName As String fName = “John” fName = textBox1.text. Reading and Writing Text Boxes. We enter data into text boxes. What is entered is text, even though a number was typed.
E N D
Assignment 3 help Dr. John Abraham Professor UTPA
Declaring variables • Use Option Explicit • Dim fName As String • fName = “John” • fName = textBox1.text
Reading and Writing Text Boxes • We enter data into text boxes. • What is entered is text, even though a number was typed. • Data entered as text must be converted to appropriate type. • Option strict is used when implicit conversions need to be controlled.
Conversion functions • Ways to convert to an integer. • Temp = CInt(expr) • Temp = Convert.ToInt32(expr) • Temp = Int(“1341”) • Temp = Integer.parse(“1341”) • Write to a textbox after converting to text • TextBox1.Text = Convert.ToString(1345.55)
Output • Console.Writeline(“The grades are {0}, {1} and {2}.”, gr1, gr2, gr3) • The values of the variables will be substituted of {0},{2} and{3} ;all other characters within the “ “ will appear exactly.
Formatted output • String.Format("{0:C}", dblMonthlyPayment) • C stands for currency with $ supplied. • output &= CDbl(begBal).ToString("0,000,000.00") & vbTab
Message Box • Three parameters for Message Box • Others: messageBoxIcon.Exclamation • MessageBoxIcon.Question • MessageBoxIcon.Error