|
This code works. Here are a few suggestions :
- assume we have two forms f1 (of type Form1) and f2 (of type Form2). In the f1 button click event handler, you can do this :
Form2 f2 = new Form2();
f2.ShowDialog();
Please note the use of Form2 (instead of Form).
- Also, don't use Dispose(). In most cases, it won't destroy/recycle the object.
|
|
|
|
|
Well I wouldnt call the dispose method as soon as you load the form, the vs doc states that the dispose method "Overloaded. Releases the resources used by the Component." So throw out the dispose method and im sure youll get it to work fine.
|
|
|
|
|
The code is wrong.
Try this
frmSearchPatient frm = new frmSearchPatient();
frm.ShowDialog();
and you can go ahead and dispose of it if you want because it is modal.
The Dispose method want be called util the dialog is closed.
|
|
|
|
|
Hi!
I'm trying to handle WebBrowser control events.
I wrote program exactly as described in this document http://support.microsoft.com/?id=312777[^] but it work only partly .
I recieve event but WebBrowser is behaving strange. When I use mouse wheel to scroll in the page it does nothing, or when I click on button it doesn't change it's state to pushed (but i recieve event).
When I remove this event handler it works ok.
Thank you!
i'm only pointer to myself
|
|
|
|
|
Tomáš Petříček wrote:
When I use mouse wheel to scroll in the page it does nothing,
Try iEvent.onmousewheel instead of iEvent.onmouseover
Tomáš Petříček wrote:
when I click on button it doesn't change it's state to pushed (but i recieve event).
When I remove this event handler it works ok.
If you receive the event, it's like preventing the web control from doing the standard handling. That's probably why the OnClick event handler is rarely used.
That said, I believe that if you set IHTMLEventObj.cancelBubble = false, you can allow the event to be routed, and give it a chance to be normally processed.
|
|
|
|
|
I found another solution here[^].
It works fine .
i'm only pointer to myself
|
|
|
|
|
Hi,
Can anyone point me to a free DataGrid better than the one which comes with VS.Net, and that support binding to a DataView/DataTable?
Thanks,
Andrei Matei
andreimatei@home.ro
|
|
|
|
|
Where should be the resource files should exist?
Is it in the application directory or bin/debug (release) directory??
If I keep the resource (.ico) in Project directory, it complains at runtime. Could not find file "C:\Project\bin\Debug\Icon1.ico".
I added this resource to the project and using it like this:
private System.Drawing.Icon myTrayIcon = new Icon("Icon1.ico");
It works properly with the app icon. (App.ico)
Why don't they have the "res" folder option (like Visual C++) in C#?
Don't and drive.
|
|
|
|
|
Resources require a special handling. It's not enough to right-click on the resource from the project hierarchy and select "embed resource" from the options.
I am talking with VC#.NET 2K2 in front of me, and I don't know yet if anything has changed in 2K3.
To add arbitrary resource files (not only icons) to a target assembly, you have to add the /win32res:<filename> to the csc.exe command line.
|
|
|
|
|
Because in .NET you can add an entire set of files, easily to any assembly.
1. Click on the file you want to add as a resource to your application and on the Build Action select "Embedded Resource"
2. Your code will need to be a little more complicated. You'll need to do something like this (I'm not in the IDE ATM, but you'll get the idea):
private System.Drawing.Icon myTrayIcon;
Assembly asm = Assembly.GetExecutingAssembly();
using (Stream st = asm.GetManifestResourceStream(asm.GetName().Name + "." + "Icon1.ico")))
{
myTrayIcon = new Icon(st);
}
See? The embedded resources are available as streams. You you think twice, this is very powerful, as anything that can take a Stream as a parameter can use a resource, without any need for special treatment for resources, like in MFC. You can easily create encrypted or compressed resources with it, too.
And, contrary to what S.Rod. has said, you can add any file as a resource. The only drawback is that it won't be a Win32 resource, but as long as you keep with managed code, you won't have any trouble.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
Daniel Turini wrote:
And, contrary to what S.Rod. has said, you can add any file as a resource. The only drawback is that it won't be a Win32 resource, but as long as you keep with managed code, you won't have any trouble.
Agreed.
|
|
|
|
|
|
Wow...so to just to add a new icon resource the above mentioned stuff needs to done!!!
So all this logic is included for App.ico? (the default icon for a form)
Thx for ur hlp.
Don't and drive.
|
|
|
|
|
I am working with IE Browser Control. When a new window event occurs I get that breakpoint no problem by implementing an axWebBrowser1_NewWindow2 method in my form.
However, I seem unable to get a handle to the new browser for that new window.
I am trying to set the ppDisp of the event like this:
e.ppDisp = axWebBrowser2.Application;
This allows the new window to show up, but I'm not sure that my axWebBrowser2 object is actually being used ?
I am unable to tie into its DocumentComplete event ? That is my question.
I tried setting a delegate to it like this:
axWebBrowser2 = new AxSHDocVw.AxWebBrowser();
this.axWebBrowser2.Application.DocumentComplete += new AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(this.testHandler);
The "testHandler(sender,event)" method is not being called when the new window shows and its document is loaded ?
Thanks in advance for any help on this - mike.
Zeno Rocks
|
|
|
|
|
This code works for me (OnDocumentComplete is triggered from the right Form instance) :
private void OnNewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)
{
Form1 newwindow = new Form1();
newwindow.Text = "(new browser window)";
e.ppDisp = newwindow.axWebBrowser1.Application;
newwindow.Show();
}
|
|
|
|
|
Thanks to .S.Rod for the suggestion. I was missing the form. Yeah this seems to now work - great !!
Zeno Rocks
|
|
|
|
|
Is there any way to append RTF text from one RichTextBox control to another
RichTextBox control.
Sonork ID 100:25668
|
|
|
|
|
I've not had a need to work with the C# RichTextBox, but with the ActiveX one, you could do
rtf1.SelRTF=rtf1.SelRTF + rtf2.SelRTF;
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
I tried following already but do no seem to work.
rtbMessage.SelectAll();
rtbDisplay.SelectAll();
rtbDisplay.SelectedRtf = rtbDisplay.SelectedRtf + rtbMessage.SelectedRtf;
Sonork ID 100:25668
|
|
|
|
|
Hi !
I've created my custom browser using the AxSHDocVw.AxWebBrowser
The object created is called with in a form that I developed.
Now when I maximize the parent window the child window ( the AxWebBrowser )
is not maximized with it.
I've used the following piece of code to handle the problem bu tit doesn't seem to work.
this.myBrowserInstance = new AxSHDocVw.AxWebBrowser();
InitializeComponent()
{
...
this.MaximizedBoundsChanged += new System.EventHandler(this.Form1_Maximize);
...
}
private void Form1_Maximize(object sender, System.EventArgs e)
{
...
System.Drawing.Size sizeOfBrowser = new System.Drawing.Size
(this.MaximizedBounds.Width - 10, this.MaximizedBounds.Height - 10);
myBrowserInstance.ClientSize= sizeOfBrowser;
...
}
Please help !
Thanx in Advance !!
((
|
|
|
|
|
This code is irrelevant.
To make sure the web browser is maximized or scaled accordingly to the parent window, you can use anchors/docks from the IDE / Properties.
|
|
|
|
|
Thank you very much
|
|
|
|
|
I have the following function:
void IVSSItem.Get(ref string Local, int Flags)
I try to use it the following way:
string fullPath = "some path";
vssItem.Get(fullPath, 0);
I get the following compilation error:
Argument '1': cannot convert from 'string' to 'ref string'
Anyone know how to use a ref string ? I tried typecasting, using the class String , and declaring the fullPath local var to be of type ref string , to no avail.
|
|
|
|
|
|
Tx Dan
|
|
|
|