|
//Label x axis. Trying to label graph axes on a WinForm
Font graphFont = new Font("Arial",8);
Brush graphBrush = new SolidBrush(Color.BlueViolet);
float x = 0.0f;
String xString = x.ToString();
for(float gx = xIndent; gx <= graphRect.Width; gx += gx)
{
g.DrawString(xString, graphFont, graphBrush, this.ClientRectangle.Left + xIndent, yOrigin + 4);
}
//THANKS FOR ANY HELP.....
|
|
|
|
|
see reply below. No need to repost...
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Rob,
EXACTLY what my App needed.Didn't even know there was such a thing as
"current culture". Many thanks.....
|
|
|
|
|
If you ever intend to write applications that might be used outside your country, you should read up on the CultureInfo[^]and System.Globalization [^] Name space. Most of the string formatting and comparison functions in .NET have overloads that expect culture specific parameters, and it is generally recommended that you use these to get predicatable results in all languages.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
how do i make my file system watcher watch my dir and all it subdir to i have to create a file system watcher for each sub dir too.
Thanks
chad
|
|
|
|
|
if i understand what you want correctly
what about IncludeSubdirectories Property
indicating whether subdirectories within the specified path should be monitored
fileSystemWatcher.IncludeSubdirectories=true
MCAD
|
|
|
|
|
thank you so much i forgot about that property
chad
|
|
|
|
|
Hi!
Im using an arraylist bound to a datagrid to show some info. I also let the user delete rows from the datagrid using a contextmenu. IE rightclick on the row, choose "delete item", and the row disappears.
Everything works fine except when I delete the last row, then when I choose another row I get a "Index out of range exception".
this is my deletemethod:
private void DeleteItem(object sender, System.EventArgs e)
{
//get the index of the selected Item, same index in the ArrayList
int index = commentGrid.CurrentCell.RowNumber;
try
{
comments.Comments.RemoveAt(index);
if (comments.Comments.Count < 1)
{
menuItemExport.Enabled = false;
toolBar.Buttons[2].Enabled = false;
}
dataChanged = true;
commentGrid.DataSource = null;
commentGrid.Refresh();
commentGrid.DataSource = comments.Comments;
commentGrid.Refresh();
}
catch(ArgumentOutOfRangeException)
{
return;
}
}
I heard this was some kind of bug in .NET, but I dont know how to work around the problem! Any help is much appreciated.
thanks!
/Rickard
|
|
|
|
|
Actually I am looking for a text control that responds to the "Enter" key event i.e. when the enter key is pressed the event handler for it is called.
Actually what i want do is that when enter key is pressed the focous shift to the next control.
Will be very thankful for you help
Your!
shahzad zafar siddiqui
|
|
|
|
|
You can achive what you want by handle keypress event
Catch enter key
Set The Focus to the next control
Try some thing like this
<code>
private void Text_KeyPress
(object sender,System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar==(char)13)
{
this.GetNextControl(textBox1,true).Focus();
e.Handled=true;
}
}
</code>
MCAD
|
|
|
|
|
hi
i want to do something like u.. when the user press "enter" after keying in some information in the textbox, it'll open something for display, for my case it's opening a tab page..
i tried the method above but it cant work.. i donno why..
my button is button3, textbox is textBox4 and it will open a tab page called tabPage6..
btw what does (char)13 mean in >> if(e.KeyChar==(char)13) ?
why is there a 13 and must i use it in my program too?
thanks
|
|
|
|
|
13 is the numeric value of the character sent by the enter key.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
nidhelp wrote:
i want to do something like u.. when the user press "enter" after keying in some information in the textbox, it'll open something for display, for my case it's opening a tab page..
i tried the method above but it cant work.. i donno why..
my button is button3, textbox is textBox4 and it will open a tab page called tabPage6
you can modify the code above to do what you want
the code did not work because -i think- the tabcontrol not the next control to textbox i mean if textbox tabindex=7 the tabcontrol should be 8
you can do somthing like that
private void Text_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar==(char)13)
{
tabControl1.Focus();
tabControl1.SelectedTab=tabPage2;
e.Handled=true;
}
}
nidhelp wrote:
btw what does (char)13 mean in >> if(e.KeyChar==(char)13) ?
why is there a 13 and must i use it in my program too?
as rob said this the value of enterkey as this numric value and KeyChar type is Char so we need to cast it
in other word convert numric value to char
one of the method to do that is
(char)13 which wil do the conversion
if you want to know the value of other key
look at
Keys Enumeration[^]
MCAD
|
|
|
|
|
i tried modifying again but it still cant work.. i want to ask..
private void Text_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) << do i write Text_KeyPress too? or should i replace Text with something else?
{
if(e.KeyChar==(char)13)
{ //this.GetNextControl(textBox1,true).Focus(); >> do i remove the //?
tabControl1.Focus(); tabControl1.SelectedTab=tabPage2; e.Handled=true;
}
}
as for tabControl1, textBox1 and tabPage2 in the above codes, do i write the relevant names of my tabcontrol, textbox and tabpage of what i want to link to/from?
thanks!
|
|
|
|
|
If you take this code Copy and Paste of course it will Not work you need to modify it
1-Text_KeyPress this function will be called when KeyPress event fire in textbox so change its name to your Function name or copy the body of the function to yours
2-The Control names tabControl1,tabPage2 and textBox1
you need to change this name to yours
MCAD
|
|
|
|
|
i have modified the codes but it still cant work.. can anyone see what's wrong with it?
private void button3_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar==(char)13)
{
this.GetNextControl(textBox4,true).Focus();
tabControl1.Focus();
tabControl1.SelectedTab=tabPage6;
e.Handled=true;
}
}
|
|
|
|
|
Can you explain again what you really want exactlly
Are you want to move to the tab control after you press Enter on button OR text control
The code you write do the folowing
If buuton control key press event fired
Set the focus to the control next to textBox4
And move focus to tabpage and select the page
So what you get when you run the code?
MCAD
|
|
|
|
|
first the user keys in something in the textbox and then he press enter on the keyboard.. after enter key is pressed, i want to move to tabPage6..
this is what i did:
private void button3_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar==(char)13)
{
this.GetNextControl(button3,true).Focus();
tabControl1.Focus();
tabControl1.SelectedTab=tabPage6;
e.Handled=true;
}
}
but when i run the app and i press enter, tabPage6 is not displayed.. only when i click on the button it will be displayed..
thanks again for your kind attention! =)
|
|
|
|
|
Of Course !
because you but the code that move the focus in command button3 keypress event handler
nidhelp wrote:
private void button3_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs
so to make this happen when key pressed in textbox you must handle keypress event so you have two choice
after subscribe to textbox keypress event like you did in commandButton pass button3_KeyPress to it like the following
this.textBox1.KeyPress += new stem.Windows.Forms.KeyPressEventHandler(this.button3_KeyPress);
or create new function and copy the code in command button
keypress event in it so the subscip line will be like this
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
Note:1-you dont have to write this code visual studio
will write it for you all you will do that you select to use existing function or new one
2-in your case you dont need this line of code
this.GetNextControl(button3,true).Focus();
Remove it or comment it by write // before them
MCAD
|
|
|
|
|
Hello everyone!
I;ve been searching everywhere and tried everything and I can't find a way to do the following
assuming i have the following xml element
<e1>
some text here <e2> blah <e2> hello <e3/> another set of text
</e1>
what happens is:
i have a string array of the 3 strings (some text here, blah, and another set of text)
i have another array of 3 objects (e1, e2, e3)
but they are separate... if i want to process them they wouldnt be in order because the order is lost as they are in different arrays..
Any ideas?
Thanks,
Michael
|
|
|
|
|
You have to check the "Do not treat <'s as HTML tags" checkbox when you write your message, to make the xml code visible. Now it is treated as broken html, so the tags doesn't show up in the message.
---
b { font-weight: normal; }
|
|
|
|
|
sorry, first post
|
|
|
|
|
The xml is broken (or you made a typo?). There is no end tag to the e2 elements.
When does it happen? What do you do? What are you going to use it for?
The xml is not formed in a good way if you want to process the data in it. If you parse the xml, you will get text elements mixed with elements. Similar to:
<e1>
<>some text here </>
<e2> blah </e2>
<> hello </>
<e3/>
<> another set of text</>
</e1>
where the <> elements represent text elements.
---
b { font-weight: normal; }
|
|
|
|
|
I want to display a float on a WinForm, but this only gives an int. Why?
SomeFunc(graphics g)
{
...
float x = 0.0f;
Font theFont(....);
//more stuff...
....
//->HERE!!
g.DrawString(x.ToString(),...
}
Why do I get "0" and not "0.0"?
thanks in advance....
|
|
|
|
|
You did not specify a format string with the ToString() method, so the default formatting in the current culture with minimum number of characters is used.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|