English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi to all Visual Basic 6 programmers: I am doing a project and i really need help.. i wanted to make it this way. when the form loaded the values on listbox sums up on a txtbox.?

to make it clear:
i wanted to have a program that will sum up all the numbers on the list box and automatically show the summed number on a textbox when the form loaded.. :) who can figure it out? any help will be appreciated.. i hope this questions helps other users too..

2007-10-02 03:21:54 · 1 answers · asked by ro_anne8 1 in Computers & Internet Programming & Design

1 answers

Make a function called TotalList which will return a double data type.

In this function declare a string, integer and double datatypes. The integer value will be used in a for next statement which will loop through values from zero to List.count -1)

Using the for/next integer value index through each listbox member using the selected property and read the selected text property into a string variable.

Using the Val() function convert the string variable into a double data type then totalize this converted value into another double data type called "total"

Upon exiting the loop return the "total" variable

Call this function after loading the list box and assign the returned value to a text box.

mtTextbox.text = TotalList

2007-10-02 04:08:44 · answer #1 · answered by MarkG 7 · 1 0

fedest.com, questions and answers