answersLogoWhite

0

What else can I help you with?

Continue Learning about Engineering

Write a program that counts by powers of 2 in visual basic?

TextBox1.Multiline = TrueDim amount As Integer = 200For index As Integer = 1 To amountTextBox1.Text = TextBox1.Text & " " & index ^ 2 & ","Next~Note: make sure you have a textbox called textbox 1


How do you create a number pad in visual basic 6 with programming that inserts the numbers into a textbox named txtKeycode?

Only one button needs to be created in the first place, with its caption set as whichever number between 0-9 that you want. After it has been set to the appropriate size, the button needs to be copied, so that the index property will appear. It would help to set the index to the same number as the caption, to avoid confusion. The code, as it turns out, is relatively simple: Private Sub Form_Load() Dim index As Integer End Sub Private sub cmdKeyPad_Click(index As Integer) txtKeycode.Text = txtKeycode.Text & cmdKeypad(index) End Sub


What is a Delphi unit?

A Delphi unit is a separate file used to store procedures and functions. If you know what a form is, a unit is exactly the same, except it has no visual interface. So you can't put windows controls on it like buttons and edit boxes. A form has windows controls and their associated code behind them, a unit only has the code. They are useful if you have some functions that you use often from many different forms and you only want to write them once. For example: function LeftStr(const S : String; Index : Integer) : String; begin If Index <= 0 then Result := '' else Result := Copy(S, 1, Index); end; function RightStr(const S : String; Index : Integer) : String; begin If Index > Length(S) then Result := '' else Result := Copy(S, Index, (Length(S)-Index+1)); end; Then you can have your unit's name in a forms uses clause and then use the functions LeftStr and RightStr from several different forms.


What is a zero based integer?

A zero based integer is a number that is either zero or a whole number. Zero based integers are usually used in programming computers with a binary code.


How do you find the product of all the items in a list box using visual basic?

Don't use a list box for this. The purpose of a list box is to present a list of items from which a user can make a selection. That's clearly not what you are trying to do. Use an array instead (you can always construct a list box from an array if required): Dim values As Integer() = {5, 3, 6, 4, 2} Dim product As Integer = values(0) For index = 1 To values.GetUpperBound(0) product = product * values(index) Next Debug.WriteLine(product) ' output ' 720 Note that the for loop starts at index 1 rather than index 0. This is because the value at index 0 is already stored in the product variable and you want to multiply that value by the indexed value to create a new product. Thus on each iteration of the loop, the product accumulates.