|
That's it, thank you very much. Much obliged to you.
|
|
|
|
|
Hi all,
Using the Key_Up or Key_Down event of a textBox i am trying to restrict the user from typing certain characters. I can do this in the Key_Press event using the KeyChar property and the Char.IsDigit().
i.e. if(char.IsDigit(e.KeyChar))
But in Key_Up or Key_Down you don't have the KeyChar property.
Any ideas?
Kev
|
|
|
|
|
|
I know that i can do that but i was hoping there would be a way of checking for a group of characters / keys i.e. All numbers, Full Stop, the Minus Sign etc.
Gues i'll just have to checkfor them all.
Thanks for your help
Kev
|
|
|
|
|
It's not as easy as with the Keypressed event but also you can check for group of characters. For example:
if (e.KeyCode < Keys.D0 || e.KeyCode > Keys.D9)
{
if (e.KeyCode < Keys.NumPad0 || e.KeyCode > Keys.NumPad9)
{
Take a look at the link I provided in my previous post.
www.troschuetz.de
|
|
|
|
|
Stefan,
Thanks for that, i wasn't aware that you could use the > and < operators
with KeyCodes and the Keys enumeration, guess i should have tried it
On another point i thought that assigning e.Handled = true; in the Key Up
event would stop the character from being displayed, this works in the
KeyPress event but in the key up event it still types the character to the
screen.
Kev
|
|
|
|
|
I think it's not possible in the KeyUp event as even the example of the MSDN topic for KeyUp uses a boolean flag which gets checked in KeyPress event to determine whether the character should be displayed or not.
www.troschuetz.de
|
|
|
|
|
Hi
I just started C++, but this code I found on the net blew me away. Could someone please help me understand, especially the lines market with a /**/.
void read_data_from_bs(void *data, int bits_of_data,
unsigned char *bit_stream, unsigned long & bit_offset)
{
int i;
int n;
while (bits_of_data > 0)
{ // <-- Colored with red by Instant Match
n = bits_of_data > 8 ? 8 : bits_of_data; /**/
*(unsigned char *)data = 0;
for (i = 0; i < n; i++)
{
if (read_bit(bit_stream, bit_offset))
{
(*(unsigned char *)data) |= (1 << i); /**/
}
bit_offset++ ;
}
data = ((unsigned char *)data) + 1; /**/
bits_of_data -= n;
}
}
|
|
|
|
|
|
Hi all,
I have created an interface in C# (obviously, since I am posting on C# forum !!!). In tht I am displaying some images using open file dialog. Now I am planning to incorporate another feature whcih is as follows, when the user moves the mouse over the image after it is opened, the corresponding pixel co-ordinates and its intensity value must be displayed on the status bar of the interface. For more clear idea (this is usually implemented in many of the image editors).
I hope I have to use 'MouseEventargs' class, but how can i implement it and incorporate in my interface...
Any advices or ideas are greatly appreciated...
thanks in advance,
Suman
|
|
|
|
|
I don't know how to get the intensity but the cursor position is easy.
Use the Form.Cursor.Position property to get the position of the cursor relative to the form, then just take into account the position of the picture on the form.
The result is the position of the cursor on the picture.
Kev
|
|
|
|
|
Hi,
I can find the intensity value (once we get the cursor position relative to our active window)... but wht i want to know is how to keep on find the position of the cursor on the imge (which u have answered, thanks for tht), but i want that process to be active always as long as the user moves his cursor on the image (ok ok we can use the image boundaries for it). then i want it to show it in my status bar panel (cordinates and intensity value) every time.
hope i am clear to the point.
any ideas/suggestions?
thanks,
Suman
|
|
|
|
|
Can u show me a sample code... in whcih this is implemented. I want to show the values in the status bar all the time as long as the user moves his mouse over the image area.
thanks,
Suman
|
|
|
|
|
That's fine, but you still didn't answer my question. I'll rephrase it. How does the business layer and the user layer communicate with each other? What is on the client side that connects to the server? What does the server expose that the client can see in order to work?
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
OK. The Business Layer is a .dll which the user layer creates an object of to expose its functions. I hope that answers the question.
Thanks Colin.
|
|
|
|
|
So, your business layer is an assembly (in .NET DLLs are properly called assemblies), and your user layer references the assembly (by Adding a Reference to the user layer's project)? Is that right?
If my assumption is correct then the business layer isn't working on the server, it is working on the client. If that is the case then probably the only thing that is one the server is the database.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Let me rephrase the question.
What I want to achieve is the following
Workstation: User Interface
Server: Business Layer and Database Layer.
How can I achieve the 'talking' between the user layer and business layer?
Is a service an appropriate way to achieve this? an example would be good. I have looked at remoting but that was too complicated for the time frame I have.
Thanks
Stephen
|
|
|
|
|
I wrote a simple text editor in C# and I would like the program to open any txt file that the user double clicks. I've been looking for a solution for weeks, anyone have any ideas?
Thanks
Azrael
|
|
|
|
|
Work on the registry, I`m not sure where, try on the txt extention. The radical way (dangerous) is to delete the txt extention in the registry, when user double click it will show you "open with" dialog
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
You want to see all your text file using your application insted of notepad or other editors. Am i right. I can suggest you a trick. Select any .txt and see the context menu while holding the shift key. Then you will get a context menu item called 'open with'. Choose that open with option. Then go for the option 'Choose program '. See this choose program option is used to run your text file when you double click any file of the type .txt. There you can browse and locate your application (.exe) file to open this .txt files. And don't forget to check 'always use this program to run files.'
Actually it is a trick.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
I can already do that, when i right click the file and use the open with... option or set the program that opens txt files by default will open my program, but the file will not load. i need to find out how to let my program know tha a file was responsibe for opening it, and then have my program load the file.
again, any ideas?
Azrael
|
|
|
|
|
The path of the file will be given to your program as a command line argument. To catch it you must adjust the main method of your program. I think it must look something like this (a long time passed since i used it ):
public static main (string[] args)
{
}
www.troschuetz.de
|
|
|
|
|
If you go to windows explorer and choose Tools>Folder Options>File Types (Tab) you can scroll down and see the mapping for .txt files. If you investigate the "open" option for txt files you will probably see a command like this:
C:\WINDOWS\system32\NOTEPAD.EXE %1
Notice that windows sends the name of the txt file as the first command-line argument to Notepad.exe.
Presumably, notepad looks for this first argument on the command line and tries to open a file at that path in the editor. You should do the same with your program.
|
|
|
|
|
what is the difference between "using" a name space and adding
a dll as a reference
TIA
|
|
|
|
|
simple, using provides you the posibility to avoid writing for every componenet of System.Windows.Forms for exemple every time you have the need
exemple
<br />
System.Windos.Forms Form = new System.Windos.Forms.Form();<br />
if you use an "using" tag you won't have to write the full namespace
and adding a dll as a reference provides you a new namespace
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|