|
How are you managing the tab page change on arrow key press?
You will need to cancel the KeyPress for the GridView and get that code for execution.
जय हिंद
|
|
|
|
|
I was hoping that there would be an easier solution!!
In other words I must "grab" the arrow-key-presses and make them do what I want them to do, not the default action.
Thanks.
|
|
|
|
|
Override ProcessCMDKey method. It will let you do that.
जय हिंद
|
|
|
|
|
|
Nigel Mackay wrote: Ta
जय हिंद
|
|
|
|
|
Thanks
|
|
|
|
|
Oh..not a problem.
जय हिंद
|
|
|
|
|
Ta = common British expression = "Thank you"
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello,
How can i declare a string in a loop that the name of the variable will be changed for example according the index of the loop. For example if i will do:
for(i=1;i<5;i++)
string k[i]="something";
it will make me 4 string variables:
k1,k2,k3,k4
I mean the name itself will be changed.
I can't use arrays instead.
|
|
|
|
|
You can't, variable names are declared at compile time.
Why you can't use an array?
|
|
|
|
|
because i want to use it as adding columns to a datagridview.
And i need it to be in loop because i take those variables from a regkeys i save before.
Can i save antire array as regkey , then read it from the registry and then add it as column names to the datagridview?
|
|
|
|
|
Use a dictionay instead.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
If what you want to do is set the name of the column, or set its headertext then you can do this in the way you first suggested.
string columnBaseName =
for (int i = 1; i < 3; i++)
{
DataGridViewTextboxColumn newColumn = new DataGridViewTextboxColumn();
newColumn.Name = columnNameBase + i.ToString();
newColumn.HeaderText = columnNameBase + i.ToString();
this.dataGridView1.Columns.Add(newColumn);
}
Hope this helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Or a dictionary...
Dictionary<int, string> getString;
for access using the int value, or
Dictionary<string, string> getString;
for access using a name (e.g. "myName"+i.tostring() )
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
there is another ways to do that for example :
System.Collections.ArrayList arr = new System.Collections.ArrayList();
for (int i = 0; i <= 10; i++)
{
arr.Add(i);
}
Console.WriteLine(arr[3]);
I know nothing , I know nothing ...
|
|
|
|
|
If it's always the same object type that's being put in the array list and you're using 2.0 or above, then better to use a generic list List<T> where T is the type of the object i.e. List<string> .
ArrayList involves unboxing/boxing which isn't a great idea.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Noted , Thank you.
I know nothing , I know nothing ...
|
|
|
|
|
Hi there!
I have a client/server program that work properly at the Internet, but with computers that have valid IP. Really I want to make a connection between two computer at the Internet that haven't valid IP, like computers that connect to internet with ISPs, that have a local IP and another IP on Internet (their server IP).
Please see below picture to understand me.
See Here
In the picture, left PC (192.168.20.14) can connect to right ISP (86.110.112.34) easily, but I want to connect to right PC (200.100.114.45). To do this, I think I have to use Port Forwarding technique. Can someone help me please?
Thanks all.
|
|
|
|
|
That is the job of router. You must set port forwarding of your router.
For example, just set port TCP:100 to IP 192.168.20.14.
In that case, if you make a connection to 86.110.112.34:100, it will
be forwarded to 192.168.20.14.
|
|
|
|
|
Thanks a lot.
but I think you mean, "if you make a connection to 92.124.210.110, it will be forwarded to 192.168.20.14".
|
|
|
|
|
"92.124.210.110" <- you don't mention it before.
probably you have a dynamic IP from your ISP.
|
|
|
|
|
I need to use some sort of pointer or other way for a variable to contain the name of another variable, it is a bit difficult to explain but the following (not correct) code will give the idea.
string varName;
string myVar;
myVar = "varName";
&myVar = "Whatever";
Now Variable varName contains "Whatever"
Any ideas or directions ?
Thanks
|
|
|
|
|
You're referring to unsafe code. Yes, you can. It's not recommended because of the potential for memory leaks, but it's possible. You wrap the code using pointers in an unsafe block, like so:
unsafe
{
}
Then you have to coerce VS into compiling it. Project properties->Build->Allow unsafe code
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Actually re-reading it I see I explained it wrongly.
What I need is an evaluations something like below is often used in scripting languages.
string varName;
string myVar;
myVar = "varName";
eval(myVar) = "Whatever";
Now Variable varName contains "Whatever"
Basically I have an array with 2 columns, 1st column has the variable name and the second has the value.
I do not want to have something like
for(x = 0; x < arrayRows; x++;)
{
if(array[x,0] = "myVar1") {myVar1 = array[x,1]}
if(array[x,0] = "myVar2") {myVar2 = array[x,1]}
..
..
}
I would like something like
for(x = 0; x < arrayRows; x++;)
{
eval(array[x,0]) = array[x,1]}
}
Of course eval does not exist in C#
Any ideas or directions ?
Thanks
|
|
|
|
|
As CG said below, you may want to use a class to store these values, using Reflection (namespace System.Reflection) to get their names and get and set their values dynamically
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|