Try MaskedTextBox! But filtering using KeyDown is still my preference. -K Jup
Anh_Tuan
Posts
-
How to restrict the user entering some invalide keys in TestBox -
Webbrowser control - opening link in new windowThat's the variable name. The activeX browser could be found on your system. With .NET 1.1 the simplest way is that you should import that COM component from system32/shdocvw.dll. .NET 2.0 already have a web browser control for you by default from the toolbox. -Good Luck Jup
-
Assembly languageLargely used in embedded systems. Sometimes pure C could be a good choice for to save development's time, however it could not replace ASM completely. Have you ever heard of "SMALL IS BEAUTIFUL" phrase, its very nice to describe ASM. Jup
-
Marshaling ObjectThanks, you're right. I forgot about address space. Should I access other's process address space to read/write data? Jup
-
Disabling "X" button in WinFormDepend on how you would like for it to behave 1. Handle form closing event, set e.Cancel to true Or 2. Use Win32 API
// constants for menu manipulation const int SC_CLOSE = 0xF060; const int MF_BYCOMMAND = 0x0; [System.Runtime.InteropServices.DllImport("user32.dll")] public static extern IntPtr RemoveMenu(IntPtr menuHwnd, int position, int flags ); public static void EnableApplicationClose( System.Windows.Forms.Form form, bool val ) { IntPtr menu = GetSystemMenu( form.Handle, val ? 1 : 0 ); if ( !val && menu != IntPtr.Zero ) RemoveMenu( menu, SC_CLOSE, MF_BYCOMMAND ); else { // needed when enabling the app close box to force it to redraw. form.Enabled = false; form.Enabled = true; } } [System.Runtime.InteropServices.DllImport("user32.dll")] public static extern IntPtr GetSystemMenu(IntPtr hwnd, int bRevert);
Jup -- modified at 9:03 Friday 7th July, 2006 -
string problem ? help please ¿Try to see Globalization on this site like these: http://www.codeproject.com/dotnet/globitfrmwk.asp[^] http://www.codeproject.com/csharp/multilanguageapplications.asp[^] Jup
-
FOP it [modified]Use to iterate thru each entry and use to find out if the node exist then dump the data as you want Jup -- modified at 11:03 Friday 7th July, 2006
-
Webbrowser control - opening link in new windowYou need to add event handlers to handle "NewWindow" event when the user clicks on a link with the target not on the current webbrowser 1. For Pre Windows XP SP2
axWebBrowser.NewWindow2
2. For Windows XP2 and later there is another event namedaxWebBrowser.NewWindow3
The whole code for this would lookaxWebBrowser.NewWindow2 += new AxSHDocVw.DWebBrowserEvents2_NewWindow2EventHandler(axWebBrowser_NewWindow2); try { axWebBrowser.NewWindow3 += new AxSHDocVw.DWebBrowserEvents2_NewWindow3EventHandler(axWebBrowser_NewWindow3); } catch ( Exception ) { // Not XP SP2 - just ignore }
Now in the event handlers all you have to do is block the new window from opening by puttinge.Cancel = true;
and redirect the current webbrowser to the new URL sent by the event. See more at NewWindow3[^] Jup -
running a function in a thread -
Marshaling ObjectHi, I have applications that need to communicate with each other using HWND_BROADCAST Here is the prototype for unmanged code function SendMessage
[DllImport("user32.dll")] extern static IntPtr SendMessage(IntPtr hWnd, int msg, MyClass myClass, IntPtr lParam);
where WParam is passed as an object reference. In the overriden WndProc method on the other application, the WParam variable is marshaled back to the original object like thisprotected override void WndProc(ref Message m) { if (m.Msg == CommonMessageID) { ... // myClass contains junk data here MyClass myClass = (MyClass)Marshal.PtrToStructure(m.WParam, typeof(MyClass)); ... } base.WndProc(ref m); }
However, it does not hold the information that was initialized by the other app. What did I do wrong here? Jup -
RichEdit ProblemUsually, when you have an image or object embedded in a richtext document you can interact with it like editing or resizing. :confused:Is there anyone who knows how to disable user interaction with these objects? Thanks, Jup
-
Disable Image (Object) manipulation in RichTextBox [modified]I have a RichTextBox control with inserted images (using Paste() from clipboard data). The problem is I don't want the user to be able to select the images and resize them using the mouse pointer. Anyone can help? Thanks, Jup
-
Print Preview & PrintHello, I have developed an application in C#, I used RichTextBox control for my word processing part. Now I want to add two more functions that are Print Preview and Print but I had not found any built-in method regarding Print issue with RTB. I am thinking about writing code for the event PrintDocument.PrintPage, hmmm. However, it seems not to be a good idea, I know that I would not have to do that if I deal with the problem using MFC. Though... Buddies suggest me what to do pls. Thanks a lot. J. Alpha