|
Hi,
on my textBox1_KeyUp event i only want to accept numeric keys, i.e., i'll only accept 0,1,2,...9. Letters and others keys will not be accepted.
Example: supose tha i wrote 123asd
i want that
textBox1.Text = 123 instead of textBox1.Text = 123asd.
My problem is that i can't do e.KeyValue = 0 ,because e.KeyValues is readonly. To e.KeyCode and e.KeyData it's the same.
Anyone knows how to solve this problem??
Thanks
Carlos Lopes
|
|
|
|
|
Is it possble to instantiate a COM object written in C# from a standard MFC app written in VC6?
ps I have only been C# for 1 day - and I have managed to implement a plugin interface that I use for VB and ATL objects and I was investigating whether we could also use C# et al
Holy Handgrenade of Antioch instructions
|
|
|
|
|
Hi CodeProject,
I have created a form with a datagrid, my requirement is that when
the user clicks "F5" I want to update a certain column with the current
time.
I defined a DataGridTableStyle and a DataGridTextBoxColumn object. I
attached an event handler to the DataGridTextBoxColumn.TextBox.KeyUp
property.
So now when I hit "F5" the column is updated, but alas, as soon as I
navigate to a different line, the row disappears! Am I doing something
wrong, or is this a bug? Maybe someone has an different way of doing this?
Anyways, this is my code for the KeyUp event:
private void dataGridColumn1_TextBox_KeyUp(object sender, KeyEventArgs kea)
{
if (kea.KeyCode == Keys.F5)
{
DataRowView drv = (DataRowView)dataGrid1.BindingContext
[dataGrid1.DataSource].Current;
drv["Col1"] = DateTime.Now.ToLongTimeString();
}
}
Thanks
|
|
|
|
|
Do you know where can I get a source code of any proxy server, working under Windows writen in C/C++??? I need it so!!! Thanks in advance.
|
|
|
|
|
System.winforms isn't there. I can access forms through System.Windows.Forms.Form but all the books I read and examples I see are using Winforms??? Is there something I am missing?
MS all the way!
|
|
|
|
|
System.winforms was renamed to System.Windows.Forms in Beta 2
Some of the examples haven't caught up yet...
|
|
|
|
|
Thanks...Does anyone know of a good reference online for the classes and what is in them?
|
|
|
|
|
Hi, i've got a little problem when trying to change a datarow caption property.
Lets say that i've :
- one DataTable named dTable;
- the DataTable as 4 DataColumns;
- supose that dTable.Columns[0].ColumnName="CodTerc"
and i do:
dTable.Columns[0].Caption = "Código";
After doing this i expected that my Grid has the first column caption = "Código", but unexpectedly the caption ="CodTerC".
I know that by default datarow caption= datarow columnName, but when i change caption i expect that my grid shows the caption not the ColumnName.
If someone has an answer for this please say something.
Thanks
Carlos Lopes
|
|
|
|
|
does anyone have example of fsream code?
|
|
|
|
|
I have written a C# component that I use in ASP and in ASP I use a
recordset which I would like to give to along as a parameter with a method
from my C# component. How do I handle this ? How can I read that recordset
and what type of variable or object must the parameter be of my c# method.
Any one ?
Thanks
Thomas
|
|
|
|
|
|
Hi, i've got a little problem when trying to change a datarow caption property.
Lets say that i've :
- one DataTable named dTable;
- the DataTable as 4 DataColumns;
- supose that dTable.Columns[0].ColumnName="CodTerc"
and i do:
dTable.Columns[0].Caption = "Código";
After doing this i expected that my Grid has the first column caption = "Código", but unexpectedly the caption ="CodTerC".
I know that by default datarow caption= datarow columnName, but when i change caption i expect that my grid shows the caption not the ColumnName.
If someone has an answer for this please say something.
Thanks
Carlos Lopes
|
|
|
|
|
I'm currently working on a project which has a registry representation in a treeview in which the user is able to write a path to a key (ex: HKEY_CURRENT_CONFIG\Software) and I'd like to select that registry key based on this string. Is there any way to do this?
Andreas Philipson
|
|
|
|
|
Hi, someone knows how can i do so RETURN key acts like TAB key????
I want that if the user presses return key then the application puts the focus on the next component.
Thanks
Carlos Lopes
Carlos Lopes
|
|
|
|
|
Hi Carlos
I am not to sure how long your message has been there and I am new to the "reply" function of the code-project.
If you have not resolved the matter- Read on!
I am assuming you are want to use the return/enter key to move from one control to another
A group of textboxes for example? with the "Type in data then press enter" option?
If so, about two years ago I had been racking my brain trying to figure out how to do that then came across the "SelectNextControl" method - from the code-project.
There are five parameters to the "SelectNextControl" method. These are
Ctl
The Control at which to start the search.
forward
true to move forward in the tab order; false to move backward in the tab order.
tabStopOnly
true to ignore the controls with the TabStop property set to false; otherwise, false.
nested
true to include nested (children of child controls) child controls; otherwise, false.
wrap
true to continue searching from the first control in the tab order after the last control has been reached; otherwise, false.
Return Value
true if a control was activated; otherwise, false.
If you are trying to use textboxes then generate two event handlers one for keydown and one for leave
the leave event I use for validating and entering the data into the program.
the keydown is to detect if a key is down (crazy that eh!)
I have several textboxes and the use exactly the same leave and keydown event handlers, in the case below "tbxUpper"
private void tbxUpper_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)
{
TextBox tbx = (TextBox)sender;
SelectNextControl(tbx, true, true, true, true);
}
}
the above event actually fires every time a key is presses in a text box but the "if statement" looks for the return key. when the return key is pressed a textbox called tbx is generated and copied from sender then the next control is selected.
If you need furthur help post a reply "and then hit Enter"!!
|
|
|
|
|
how can i change/rename an existing regestry key/value (in c/c++ code).
|
|
|
|
|
Bwhaahahahahahaaaa - this is great. The first and only question on the C# board is about straight C !!!!
Sorry, I don't mean to laugh at your question, I just find it amusing that it's the first question on the board for C#.
Some pointers for you in future.
1/ Put something meaningful in your header. C ? What does that mean ?
2/ Post to the right board. There is a lively board on C/C++, where you'll find questions answered a lot faster than in this barren place.
There is a registry class or two here at CP which I would expect would do what you want. Just search for registry and see what comes up.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
CRegKey class have no rename func
|
|
|
|
|
The CRegistry class has a rename function.
Christian
Secrets of a happy marriage #27:
Never go to bed if you are mad at each other. It's more fun to stay up and fight.
|
|
|
|
|
Do u have any example code 4 me
|
|
|
|
|
Hi, on my app, i've 2 forms (form1 and form2).
On form2 i've dropped a combobox (named cb1) and declared it has public( public System.Windows.Forms.ComboBox cb1;).
Now, i want to access it from form1 (whit a statment like this one:
Form f2 = new form2();
f2.cb1.size.With = 30;)
, but i do not have access to it...????
What do i need to do to see my form2 combobox from form1, i thought that it would bee enough to declare it public, but looks like i'm wrong...
Thanks
Carlos Lopes
|
|
|
|
|
You'll have to make that combobox a property (read-only).
|
|
|
|
|
Where can I find a website that has a reference to all the API's in C#? I want all the methods in System.net.*, etc....I want to know what I can call! Like what's in the headers of C/C++, if you're confused. Thanks!
|
|
|
|
|
You have two choices:
1) Use MSDN online, at http://msdn.microsoft.com
2) Get VisualStudio.NET, and use MSDN locally.
|
|
|
|
|
I've tried to use MeasureString function and noticed that it almost always returns size that is noticeably wider then the actual string. So, I was wondering if any one can comment on this behavior. Is it a bug or a feature Also, does anybody else thinks that support for text output in .NET SDK is totally inadequate? How is one can change kerning or get character glyph?…
|
|
|
|