Visual Basic Development Bookmark and Share   
 Home > Visual Basic General > Multiply variables...
 

Multiply variables...

how would i go by multiplying two variables..

ListBox1.SelectedItem.ToString() * Label1.Text.ToString() = Label2.Text
is what i have but it seems to not want to do it... :/


http://cid-9f07dcb04e907112.skydrive.live.com/self.aspx/My%20Software/Attributor%202.0.exe
Dmitry Post  5 hours 28 minutes ago

if you want to get Result on Label3 then Write it On Right side of < = > Sign

label3.text=label1.text * listbox1.selecteditems




www.shariqdon.media.officelive.com
ShariqDON  5 hours 19 minutes ago

if you want to get Result on Label3 then Write it On Right side of < = > Sign

label3.text=label1.text * listbox1.selecteditems




www.shariqdon.media.officelive.com
ShariqDON  5 hours 19 minutes ago

Remamber :

Left Hand Side (is Result ) = Right hand side( Whose Results)


www.shariqdon.media.officelive.com
ShariqDON  5 hours 6 minutes ago
You need to convert the list box or label values into numeric format before you can multiply them.

When you get the result, you need to put it back into a control as text.

The TryParse method is the most suitable becasue it provides a check that the values can be converted to numbers. I am assuming that you want to multiple the contents of ListBox1.SelectedItem by Label1 and place the result in Label2. The numbers will be handled as Double.

        Dim N1 As Double
        Dim N2 As Double
        If Double.TryParse(ListBox1.SelectedItem.ToString, N1) AndAlso Double.TryParse(Label1.Text, N2) Then
            Dim Result As Double = N1 * N2
            Label2.Text = Result.ToString
        End If




Acamar  4 hours 46 minutes ago

You can use google to search for other answers

Custom Search

More Threads

• String to integer conversion
• Help with binding User Settings to Combo Box
• Printdocument speed (Vista versus XP Pro)
• DataSet, nested classes
• Design issue in IsNumeric() function
• child forms creeping
• Using WriteLine
• StopWatch Sample in 101 samples
• Is there any way to gather remote computer information WITHOUT using WMI
• HOW CAN I PROVIDE MULTI LANGUAGE SUPPORT IN MY WINDOWS APPLICATION DEVELOPED IN VB.NET?