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 -
For i As Integer = 0 To 1
-
For j As Integer = 0 To 1
-
FirstMatrixArray(i, j) = Val(txtInput.Text)
-
txtInput.Text = ""
-
txtInput.Focus()
-
End If
-
Next
-
Next
-
Let me know your idea about this
Hope your reply
4 2750
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.
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.
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. - int i = 0, j = 0;
-
int maxi = 2, maxj = 2;
-
int[,] matrixArr = new int[maxi,maxj];
-
-
private void btnSubmitValue_Click(object sender, EventArgs e)
-
{
-
this.matrixArr[i,j] = this.txtInput.Text;
-
j++;
-
if(j >= this.maxj)
-
{
-
j = 0;
-
i++;
-
}
-
if(i >= this.maxi)
-
{
-
//array has been filled if it reaches this line
-
this.txtInput.Enabled = false;
-
this.btnSubmit.Enabled = false;
-
}
-
}
I have used an online converter to convert it to vb .net, but havent tested it - Dim i As Integer = 0,j As Integer = 0
-
Dim maxi As Integer = 2,maxj As Integer = 2
-
Dim matrixArr(,) As Integer = New Integer(maxi,maxj) {}
-
-
Private Sub btnSubmitValue_Click(ByVal sender As Object, ByVal e As EventArgs)
-
Me.matrixArr(i,j) = Me.txtInput.Text
-
j = j + 1
-
If j >= Me.maxj Then
-
j = 0
-
i = i + 1
-
End If
-
If i >= Me.maxi Then
-
'array has been filled if it reaches this line
-
Me.txtInput.Enabled = False
-
Me.btnSubmit.Enabled = False
-
End If
-
End Sub
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. - int i = 0, j = 0;
-
int maxi = 2, maxj = 2;
-
int[,] matrixArr = new int[maxi,maxj];
-
-
private void btnSubmitValue_Click(object sender, EventArgs e)
-
{
-
this.matrixArr[i,j] = this.txtInput.Text;
-
j++;
-
if(j >= this.maxj)
-
{
-
j = 0;
-
i++;
-
}
-
if(i >= this.maxi)
-
{
-
//array has been filled if it reaches this line
-
this.txtInput.Enabled = false;
-
this.btnSubmit.Enabled = false;
-
}
-
}
I have used an online converter to convert it to vb .net, but havent tested it - Dim i As Integer = 0,j As Integer = 0
-
Dim maxi As Integer = 2,maxj As Integer = 2
-
Dim matrixArr(,) As Integer = New Integer(maxi,maxj) {}
-
-
Private Sub btnSubmitValue_Click(ByVal sender As Object, ByVal e As EventArgs)
-
Me.matrixArr(i,j) = Me.txtInput.Text
-
j = j + 1
-
If j >= Me.maxj Then
-
j = 0
-
i = i + 1
-
End If
-
If i >= Me.maxi Then
-
'array has been filled if it reaches this line
-
Me.txtInput.Enabled = False
-
Me.btnSubmit.Enabled = False
-
End If
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
...
|
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...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |