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 2666
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...
|
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...
|
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...
|
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...
|
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???...
|
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>
...
|
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...
|
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...
|
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...
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: teenabhardwaj |
last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: CD Tom |
last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
| |