Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do i create a script for an array

Posted on 2006-11-29
12
Medium Priority
?
189 Views
Last Modified: 2010-04-23
I need to create a Script were i have 3 colums and four rows I will have to put some default numbers in each text box and i guess the part that I really dont understand is how do i make the calculation to multiply down the colum and subtract from each row in a script format; for example

5   | 2   | 3
8   | 32 |1
4   | 9   | 10
17 | 15 | 12

I would like for my script to Multiply 5*8*4*17 and have the answer populate on a popup box and at the same time subract 5-2-3 and the answer populate on the same popup when i presss my calculate button.
0
Comment
Question by:TAMSCODAN
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18037866
Can you define "script" please?

You are working in?

    VBScript (.vbs)
    VB6 (or below)
    VB.Net 2003 (or below)
    VB.Net 2005

"I will have to put some default numbers in each text box"

So you have TextBoxes on a Form already that you are pulling these numbers from?

Give more details...
0
 
LVL 3

Author Comment

by:TAMSCODAN
ID: 18037901
Well what i am reffering to is the code that I am writing for the form I have 12 total text boxes and they are arranged in three colums and four rows. I am Using Visual Studio using VB.NET 2005. In the code I will need some numbers to be populated by default in all the text boxes such as i explained above.
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18037990
Hi TAMSCODAN;

>> I will need some numbers to be populated by default in all the text boxes such as i explained above.

Will this number be the same each time the form is opened?
Will the default number be the same in each text box?
What are the numbers?
You talk about an array. Is this the arrangement of text boxes or do they have to be in a 2d array?

Fernando
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18038029
If you want default numbers then just set the Text() property of the TextBoxes at design-time in the IDE for each TextBox.

"I would like for my script to Multiply 5*8*4*17 and have the answer populate on a popup box and at the same time subract 5-2-3 and the answer populate on the same popup when i presss my calculate button."

To help with this part we need to know the NAMES and the LAYOUT of the TextBoxes on your form...
0
 
LVL 3

Author Comment

by:TAMSCODAN
ID: 18038325
I havnt defined the names of the textboxes therefore they currently have the defalt names as TextBox1, TextBox2 and so on
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18038364
Ok.

We still need to know the LAYOUT of them on your form.

TextBox1   TextBox2   TextBox3
TextBox4   TextBox5   TextBox6
TextBox7   TextBox8   TextBox9
TextBox10 TextBox11 TextBox12

or

TextBox1   TextBox5   TextBox9
TextBox2   TextBox6   TextBox10
TextBox3   TextBox7   TextBox11
TextBox4   TextBox8   TextBox12

0
 
LVL 3

Author Comment

by:TAMSCODAN
ID: 18038400
This is the way that I set it up

TextBox1   TextBox5   TextBox9
TextBox2   TextBox6   TextBox10
TextBox3   TextBox7   TextBox11
TextBox4   TextBox8   TextBox12
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 18038787
Add some Labels:

TextBox1   TextBox5   TextBox9     Label4
TextBox2   TextBox6   TextBox10   Label5
TextBox3   TextBox7   TextBox11   Label6
TextBox4   TextBox8   TextBox12   Label7
Label1       Label2       Label3

Then something like...

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Label1.Text = CInt(TextBox1.Text) * CInt(TextBox2.Text) * CInt(TextBox3.Text) * CInt(TextBox4.Text)
            Label4.Text = CInt(TextBox1.Text) - CInt(TextBox5.Text) - CInt(TextBox9.Text)

            ' similar code for the other columns/rows
            ' ...
        Catch ex As Exception
        End Try
    End Sub

You could probably use a Grid more efficiently instead...
0
 
LVL 3

Author Comment

by:TAMSCODAN
ID: 18038827
How would you do it with a Grid and What should i declare as a Variable?
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18038901
What version VB.Net are you working with?...
0
 
LVL 3

Author Comment

by:TAMSCODAN
ID: 18038925
I am Unsure its from the Visual Studios 2005. I am at work and i dont know how to check it.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18069249
Click on Help --> About...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question