Thursday, February 9, 2017

Use of Listgridview and Loop for Multiplying To Given Number.....

Listbox with Loop Adding Items ....code

Loop is very important for any programmer. It makes work easier and faster with same pattern of data for provided ending points. Here is an example of loop with multiplying numbers as much user desired to have.
It is very useful when we want to get data or multiplication from 0 to ending points.

Now , you need to design the form with textbox , buttons and listview to display the data processed.
Here is a image that i have designed .You  can design in your own way and run the program.

Now you can place this code to the Click to Get Result button for processing the data.

---------------------------------------

Dim I As Integer
        Dim AB As Integer
        Dim AC As Integer
        AC = TXT2.Text
        ListBox1.Items.Clear()
        For I = 1 To AC
            AB = TXT1.Text * I
            ListBox1.Items.Add(TXT1.Text & "X" & I & "=" & AB)
        Next I


 --------------------------------------
You can see the code , its very easy and can work. Simply i have defined the variables AB , AC. Then passing the value to variable AC from textbox which we have to input data from the design. Then clearing the ListBox items if there are any old values remaining. Then value passing to Loop , and Lastly getting value in variables AB and adding the processed data in Listbox. When it is added , the data are formatted and designed to understandable format for the user.

Now i am going to get Multiplication of 5 from to 50.

 

As a result you can see the output. This is simple and mostly used techniques for any program.
You van try it in another way also as you know how to handle the listbox , loop. 

Thank you

Narayan Aryal
 Butwal
Nepal

No comments:

Post a Comment