-
August 9th, 2009, 07:05 AM
#1
Inserting textbox values in table
Hi!!!
I am making a window application in which there is a textbox in which we have to enter only numeric values...
How can I display a table on the form which has columns - ones,tens,hundred ,thousand,ten thousand,lakh , ten lakh etc. Now whatever number we enter in textbox that number should automatically get filled in this numeration table ....
For example , number entered is 2589,then in table 9 should be in ones column , 8 in tens, 5 in hundreds, 2 in thousands column................
How can I do this.....
-
August 9th, 2009, 12:10 PM
#2
Re: Inserting textbox values in table
You will use a GridView control to display the table. A simple logic to do this would be to convert the number into a string and then use SubString() method to get the ones, tens, hundreds, etc.
-
August 9th, 2009, 11:46 PM
#3
Re: Inserting textbox values in table
There is no database connectivity..........
Simply a number is entered in textbox and I want that number to be displayed in table
-
August 10th, 2009, 01:40 AM
#4
Re: Inserting textbox values in table
yes it is not necessary to use GridView for this problem.
i wrote this code for you:
Code:
private void button1_Click(object sender, EventArgs e)
{
string number = textBox1.Text;
char[] digits = number.ToCharArray();
int pos = 0;
foreach (char d in digits)
{
Control cnt = tableLayoutPanel1.GetControlFromPosition(pos,1);
Label lbl = (Label)cnt;
lbl.Text = d.ToString();
pos++;
}
}
to get the code work please add TableLayoutPanel to your form with 2 rows and 4 columns (first row canbe used as header for titles) then put lables in every cells and change the name of the lables in the first row to the tiles you want like (1s,10s,100s etc.)
Please rate my post if it was helpful for you. Java, C#, C++, PHP, ASP.NET
SQL Server, MySQL
DirectX
MATH Touraj Ebrahimi
[toraj_e] [at] [yahoo] [dot] [com]
-
August 10th, 2009, 12:53 PM
#5
Re: Inserting textbox values in table
Originally Posted by vinnijain
There is no database connectivity..........
Simply a number is entered in textbox and I want that number to be displayed in table
GridView does not mean that you have to have a database connectivity. You can use GridView for anything where a table can be used.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|