473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

VB.NET App: store a value in vb.net at run time

karthickbabu
Is Possible to store a value to declared Variable from Text Box at run time. I want to store a value from Text Box in 2 dimension array. First Value can be sotred in variable(0,0). If i press enter text box will be cleared and get another number and it stored in variable(0,1) and so on

I try like this, but not working any problem in this code
Expand|Select|Wrap|Line Numbers
  1.          For i As Integer = 0 To 1
  2.               For j As Integer = 0 To 1
  3.                    FirstMatrixArray(i, j) = Val(txtInput.Text)
  4.                        txtInput.Text = ""
  5.                        txtInput.Focus()
  6.                    End If
  7.                Next
  8.          Next 
  9.  
Let me know your idea about this

Hope your reply
Dec 3 '07 #1
4 2750
CyberSoftHari
487 Expert 256MB
The code you done will update the 2d array every time you trigger the enter.
1. Give i and j declaration as private in that class.
2. Increment i and j value after enter press (in key press event).
3. write assignment statement for FirstMatrixArray(i, j) in key press event after FirstMatrixArray index changed.
Dec 3 '07 #2
I tried all possible ways. But i couldnt get anything. Let me give any example it will help to me.

The code you done will update the 2d array every time you trigger the enter.
1. Give i and j declaration as private in that class.
2. Increment i and j value after enter press (in key press event).
3. write assignment statement for FirstMatrixArray(i, j) in key press event after FirstMatrixArray index changed.
Dec 6 '07 #3
Shashi Sadasivan
1,435 Expert 1GB
use variables i and j in the class (class variables)

and use the button click event (users hits enter / clicks the button to submit the value)

set i and j to 0 on the load of the form.

Expand|Select|Wrap|Line Numbers
  1. int i = 0, j = 0;
  2. int maxi = 2, maxj = 2;
  3. int[,] matrixArr = new int[maxi,maxj];
  4.  
  5. private void btnSubmitValue_Click(object sender,  EventArgs e)
  6. {
  7.    this.matrixArr[i,j] = this.txtInput.Text;
  8.    j++;
  9.    if(j >= this.maxj)
  10.    {
  11.        j = 0;
  12.        i++;
  13.    }
  14.    if(i >= this.maxi)
  15.    {
  16.        //array has been filled if it reaches this line
  17.        this.txtInput.Enabled = false;
  18.        this.btnSubmit.Enabled = false;
  19.    }
  20. }
I have used an online converter to convert it to vb .net, but havent tested it

Expand|Select|Wrap|Line Numbers
  1. Dim i As Integer =  0,j As Integer =  0 
  2. Dim maxi As Integer =  2,maxj As Integer =  2 
  3. Dim matrixArr(,) As Integer =  New Integer(maxi,maxj) {} 
  4.  
  5. Private  Sub btnSubmitValue_Click(ByVal sender As Object, ByVal e As EventArgs)
  6.    Me.matrixArr(i,j) = Me.txtInput.Text
  7.    j = j + 1
  8.    If j >= Me.maxj Then
  9.        j = 0
  10.        i = i + 1
  11.    End If
  12.    If i >= Me.maxi Then
  13.        'array has been filled if it reaches this line
  14.        Me.txtInput.Enabled = False
  15.        Me.btnSubmit.Enabled = False
  16.    End If
  17. End Sub
Dec 6 '07 #4
Hi
Thanks I got some ideas from your code. I will try this code. Surely it will be help to me. I reply after i test this code with my code

Once again thanks



use variables i and j in the class (class variables)

and use the button click event (users hits enter / clicks the button to submit the value)

set i and j to 0 on the load of the form.

Expand|Select|Wrap|Line Numbers
  1. int i = 0, j = 0;
  2. int maxi = 2, maxj = 2;
  3. int[,] matrixArr = new int[maxi,maxj];
  4.  
  5. private void btnSubmitValue_Click(object sender,  EventArgs e)
  6. {
  7.    this.matrixArr[i,j] = this.txtInput.Text;
  8.    j++;
  9.    if(j >= this.maxj)
  10.    {
  11.        j = 0;
  12.        i++;
  13.    }
  14.    if(i >= this.maxi)
  15.    {
  16.        //array has been filled if it reaches this line
  17.        this.txtInput.Enabled = false;
  18.        this.btnSubmit.Enabled = false;
  19.    }
  20. }
I have used an online converter to convert it to vb .net, but havent tested it

Expand|Select|Wrap|Line Numbers
  1. Dim i As Integer =  0,j As Integer =  0 
  2. Dim maxi As Integer =  2,maxj As Integer =  2 
  3. Dim matrixArr(,) As Integer =  New Integer(maxi,maxj) {} 
  4.  
  5. Private  Sub btnSubmitValue_Click(ByVal sender As Object, ByVal e As EventArgs)
  6.    Me.matrixArr(i,j) = Me.txtInput.Text
  7.    j = j + 1
  8.    If j >= Me.maxj Then
  9.        j = 0
  10.        i = i + 1
  11.    End If
  12.    If i >= Me.maxi Then
  13.        'array has been filled if it reaches this line
  14.        Me.txtInput.Enabled = False
  15.        Me.btnSubmit.Enabled = False
  16.    End If
  17. End Sub
Dec 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Chris Dunaway | last post by:
A quick scan of the group did not immediately reveal an answer to my questions so here goes. First let me describe my app and then I'll ask the questions. I am writing a Windows Forms App (not...
33
by: MLH | last post by:
I've read some posts indicating that having tons of GV's in an Access app is a bad idea. Personally, I love GVs and I use them (possibly abuse them) all the time for everything imaginable - have...
7
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the...
3
by: Tim Gallivan | last post by:
Hi all, I think read somewhere (but I can't find it ... note to self: must get new filing system ...) that there is a workaround so that an app.config can have multiple keys with the same name...
2
by: Dotnet Gruven | last post by:
Hi, If a server is physically localled in CST and is shared, how can one create a Web Application on that server that has its timezone for EST??? I've seen other threads in this group that...
10
by: Brett Romero | last post by:
I'd like to store something such as the following the my app.config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="DEBUG" value="true"/> <add...
6
by: NickP | last post by:
Hi there, I am implementing a simple "/U" command line argument for a .NET application that instructs the application to delete the following folders... ...
8
by: Andrus | last post by:
..NET 2 Winforms application. How to create new setting and set it default value in userSettings section of app.config file or overwrite existing setting value ? I found code below in this list...
3
by: =?Utf-8?B?Sm9u?= | last post by:
Hello, I have tried to use the app.config and settings.cs files to store my data (which I want to be user changeable at runtime). I can write to (what I assume is an object in memory) and it does...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.