|
I want to only int in text control how this can happen;
|
|
|
|
|
In case you use .Net 2.0 you can use the MaskedTextBox control.
Otherwise take a look at the following example copied from the MSDN topic of KeyPress event:
private bool nonNumberEntered = false;
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
nonNumberEntered = false;
if (e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9)
{
if (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9)
{
if(e.KeyCode != Keys.Back)
{
nonNumberEntered = true;
}
}
}
}
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (nonNumberEntered == true)
{
e.Handled = true;
}
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
How can i get the path of the selected item from the listview.
Thanks In Advance.
Ravi
|
|
|
|
|
|
Hi,
i hace displayed the selected tree view node items in the list view control and upon selecting the item
i need to get the path of the item so that on clicking that item i should repopulate the listview with selected directory items.
Thanks
Ravi
|
|
|
|
|
In a DataGridViewComboBoxColumn I can get everything set up fine with the DisplayMember as one column of a DataTable.
Since the DataTable contains separate columns for firstname and lastname, and I'd like both displayed in the list, is there a way to set the DisplayMember property to show a combination of data columns (e.g. lastname + ", " + firstname)?
Or, am I going to have to perform the concatenation in some other part of the application/database?
|
|
|
|
|
Hi, I'm wondering if there are any differences between the System::Byte type , unsigned int and the unsigned char in terms of structure and performance?
They are all 8-bits long, am i correct?
Thanks
|
|
|
|
|
bankai123 wrote: They are all 8-bits long, am i correct?
No. an int is definately not 8 bit. What made you think that ?
int is 32 bit.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
woops, my mistake , so what are the differences between the System::Byte and a unsigned char?
|
|
|
|
|
I'd be astounded if there were any.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
This table might be of use, in C# chars are 16 bits.
|
|
|
|
|
Hi...I'm trying to develop a generic "Bar" class inside XNA and thought I would investigate a method(development method....not a literal C# "method") of accomplishing this and was hoping that someone might be interested as well.
What I am wanting to do is pass an "OrientationString" through the constructor and conditionally compile the update methods based upon this string. (I know that I could accomplish this task through inheritance....but that's one of the reasons why I'm not doing it that way)
The functionality I desire is:
I know the following code will not work...please don't reply saying as such
because I already know that. It is pseudocode
#undef HORIZONTAL
#undef VERTICAL
public Bar(int x, int y, string OrientationString)
{
this.x = x;
this.y = y;
#if(OrientationString.ToUpper().Equals("VERTICAL"))
{
#define VERTICAL
}
#elif(OrientationString.ToUpper().Equals("HORIZONTAL"))
{
#define HORIZONTAL
}
}
[Conditional("VERTICAL")]
public void UpdateVertical()
{
...
}
[Conditional("HORIZONTAL")]
public void Update HORIZONTAL
{
...
}
I basically want to control conditional compilation at run-time(*scratches head*......did I just say that?)
Does anyone know of a way to represent this logic in C#? I investigated the Attribute class but couldn't get very far with it.
-- modified at 23:58 Wednesday 4th October, 2006
|
|
|
|
|
First question that arrises is: Why do you want to do that? Can't you just include both methods in the application? This is most likely not possible to do in C# or any language for that matter.
WM.
What about weapons of mass-construction?
|
|
|
|
|
|
Not sure if its possible, but I have no idea why you would want to do it this way? You could just do an if/else sending execution to the proper method or if you end up having more than two options use a switch. Also, instead of a string use an enum. You are looking for a finite number of specific values (in this case 2, "HORIZONTAL" and "VERTICAL") by using an enum you force callers to pass valid values.
public enum Direction
{
Horizontal,
Vertical
}
public class Bar
{
public Bar(int x, int y, Direction dir)
{
this.x = x;
this.y = y;
if (dir == Direction.Horizontal)
UpdateHorizaontal();
else
UpdateVertical();
}
}
|
|
|
|
|
Can any one plz make a regular expression for me:
The input string is of the form:
BLAH BLAH ^##$[FRUIT]APPLE[/FRUIT] #$&&^*^%&^$%#@$ BLAH BLAH
I want to extract [FRUIT]APPLE[/FRUIT] from the above string firstly using Regex. After that i want to extract APPLE from [FRUIT]APPLE[/FRUIT] using Regex.
Can someone plz help me writing regular expression for this pattern. I am trying but ending in failure may be because of the presence of Big bracket '['
Imtiaz
|
|
|
|
|
use \[ and \] to insert the brackets. Google Expresso and download it, it's invaluable in these situations.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
You don't need a regular expression to extract APPLE from [FRUIT]APPLE[/FRUIT].
string fruitType = fruitTag.SubString(7, fruitTag.Length - 15);
---
b { font-weight: normal; }
|
|
|
|
|
hi
u can use a tool like expresso to do some more RND on regular exp. It will guide u to write regular expresion. After that go to Tools/View Code it genearte ur C# code for that exp.
u can dowload this from . Its free
http://www.ultrapico.com/Expresso.htm
Regards.
|
|
|
|
|
\[FRUIT\](.+)\[/FRUIT\]
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hello I've been googling for what seems like days now and can't find an answer to what I would think would be an easy thing to do. I have an application that uses a web browser to do a few automated tasks which I have programed. The browser has various sounds are generated and I want to be able to mute the volume of it.
My program doesn't have any need for volume at all so I really just want a way to mute the volume of my entire program. I read a ton about how to control the windows mixer but this doesn't include application specific volume control.
Is there any way to control the application volume and not affect anything else in the system?
btw, I'm using the AxSHDocVw.AxWebBrower for my browser
Brett Nottingham
|
|
|
|
|
From what I read application volume control will only be implemented in Windows Vista (see this[^]), which means it is not implemented in previous versions of Windows. So the answer is no.
However, I found this[^] which seems to be doing what you requested.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
When i first started to learn about the binary system i always ended up learning that to count in binary you work from right to left. 128,64,32,16,8,4,2,1. But while looking at the Netflow packet 9 format from cisco. (http://www.cisco.com/en/US/tech/tk648/tk362/technologies_white_paper09186a00800a3db9.shtml) it shows the field bit positions starting from left to right. [0,1,2,3,4,5,6,7]. how to I align up those bit values? does bit position 7 have a value of 1, or 128? or does this not matter since i am reading my data from a byte array and then i could just use the convert.tostring(2,byte) to view the binary data and the resulting string would be in the format of 128,64,32,16,8,4,2,1? thanks. hopefully i'll figure this out soon so i can get to sleep before 3am like last night!!
|
|
|
|
|
</asp:textbox><asp:radiobuttonlist id="RadioButtonList1" OnSelectedIndexChanged = "VisibilityControl();" style="Z-INDEX: 110; LEFT: 208px; POSITION: absolute; TOP: 144px"
runat="server" Width="73px">
I get compile error when I try adding the visiblitycontrol() function to the selected index change event of the radio button list. Any hints?
-- modified at 19:21 Wednesday 4th October, 2006
|
|
|
|
|
I'd have thought the correct syntax would not involve brackets or a semicolon.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|