|
Thank u.
FormClosedEventArgs ev = new FormClosedEventArgs(/*??? */);
MainForm_FormClosed(sender, ev);
Please tell me how can i call? What to write in argument, wat to write in CloseReason?
|
|
|
|
|
try one of these:
myMainForm.Close();
Close(); // inside main form class
Application.Exit();
Luc Pattyn
|
|
|
|
|
oooh very thanks.
I am still new with C# after 2 months
|
|
|
|
|
Just call Close on your File Exit handler. It will try to close the form, raising the Closing event in the process. If nothing cancels the closing, then you get the Closed event.
You don't have to call your Closing event handler manually.
|
|
|
|
|
I think you can send the win32AI message "WM_CLOSE" when the button is clicked like a function in win32 SDK "SendMessage()" function:
like this:
// define
[DllImport("User32.dll")]
public static extern IntPtr FindWindow(String lpClassName, String lpWindowName);
[DllImport("User32.dll")]
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
const int WM_LBUTTONDOWN = 0x201;
const int WM_LBUTTONUP = 0x0202;
// sample, u should use spy++ to find windows class name and control class name
IntPtr hwndWin = FindWindow("TfrmMain", "window title");
if (hwndWin.Equals(IntPtr.Zero) == false)
{
IntPtr hwndBtn = FindWindowEx(hwndWin, IntPtr.Zero, "TButton", "control text");
if (hwndBtn.Equals(IntPtr.Zero) == false)
{
SendMessage(hwndBtn, WM_LBUTTONDOWN, IntPtr.Zero, IntPtr.Zero);
SendMessage(hwndBtn, WM_LBUTTONUP, IntPtr.Zero, IntPtr.Zero);
}
}
|
|
|
|
|
Hi everyone!
I have questions ...
How can i search treeNodes in an treeView using treeNode.Name property?
How can i highlight resultant nodes?
Please need some idea. Thanks.
|
|
|
|
|
h@s@n wrote: How can i search treeNodes in an treeView using treeNode.Name property?
You'd have to go through all nodes recursively.
h@s@n wrote: How can i highlight resultant nodes?
Call TreeNode.Select(), or TreeNode.Selected = true
Regards
|
|
|
|
|
Hi all,
I'd like to know how you make your application to support localizationand if you prefer to work with resources files and its namespace or you prefer to work with external xml files and tools (like gettext, ...). Why have you chosen your way?
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Marc Soleda wrote: if you prefer to work with resources files
Yes.
Marc Soleda wrote: Why have you chosen your way?
1- It's more generic.
2- Mthods and classes are built-in.
3- Has a lot of documentaion. You'll know easily when you screw up
4- Most important => It takes less to code and maintain.
Regards
|
|
|
|
|
Hi,
you can also, enable islocalizable property,
then simply select language,
then type necassary text,
save it,
vs will create a localize res.
you can also see it in the debug folder as a dll..
Cheers.
http://mp3-album.blogspot.com
|
|
|
|
|
hi
In my case i have diferent user with diffrentent language preference. So as per user's login language id is comming from db.
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("langID");
Then i am having a .resx file for common messages. And for each .aspx page i have .aspx.[langID].resx file.
And some code to get data from this .resx file like
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("namespace address", typeof(Resources).Assembly);
This way we donot need a thridparty tool and maintenace is quit easy.
|
|
|
|
|
1 private void AddPlugin(Assembly pluginAssembly) {
2
3 //Loop through all the Types found in the assembly
4 foreach (Type pluginType in pluginAssembly.GetTypes()) {
5 //Only look at public and non-abstract types
6 if (pluginType.IsPublic && !pluginType.IsAbstract) {
7 Type typeInterface = null;
8 try {
9 //Gets a type object of the interface we need the plugins to match
10 typeInterface = pluginType.GetInterface("IPlugin", true);
11 }
12 catch (Exception) { }
13
14 //Make sure the interface we want to use actually exists
15 if (typeInterface1 != null) {
16 //Create a new available plugin instance
17 T newPlugin =
18 (T)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
19
20 availablePlugins.Add(newPlugin);
21 }
22 }
23 }
24 }
Here's a method I've got in a generic PluginManager class with parameter T.
It adds a plugin of the right type to a list of available plugins.
The problem I've got is in line 10. Instead of "IPlugin" (The parent interface of the different interfaces for plugins (IParser, ISolution, etc.), something like "T" should be used.
Unfortunatly I couldn't find out how to get the name of the parameter T as a string.
ToString and casting doesn't work on the generic parameter.
Is there any way of getting the right string ("IParser", "ISolution", etc.) depending on the chosen parameter T?
|
|
|
|
|
Try looking at the methods in pluginType which have generic in them, e.g. you might want to try pluginType.GetGenericParameters (I think it's called that anyway).
I have no idea what I just said. But my intentions were sincere.
|
|
|
|
|
I found a solution, but I'm not quite happy with it.
I simply pass the string I need to the constructor, when I create an instance of the class.
Thanks for the help
I'll check it out, it might be the cleaner way of accessing the string I need.
|
|
|
|
|
Hi all,
I create a second form on my main form like this.
private void btnEntryForm_Click(object sender, EventArgs e)
{
EntryForm frm = new EntryForm();
frm.Show();
}
Then I want my second form behave like any other control. That means when I
resize, move, minimize or maximize,etc. the main form I want my second form keep its location on the main form same and follow all the other events, like an ordinary control on the main form. How ?
Thanks in advance
Muharrem
-- modified at 13:19 Sunday 17th December, 2006
|
|
|
|
|
Hi
I advice you to write a inherited class from windows.form class,
then add any property in that class.
even you can add eventhandlers
or use predefined eventhandlers
like;
form_resized += new EventHandler...
you can handle them from your parent form that is your class
hope it helps.
Cheers.
|
|
|
|
|
using toggled value with in the column like stop and start when clicking start stop should be hide and again when clicking stop then start should be hide so i have tried this using div but could not get result so anybody has suffering from such kinds of troubled and have solution then give me the hints i will be appreciates for u.
hikbnet
|
|
|
|
|
I don't know how to set a program to start at startup.
Help.
Vasildb
|
|
|
|
|
You could make a hotlink for your application and put it in the windows startup folder for instance.
-Larantz-
|
|
|
|
|
Another solution is to insert a registry entry at:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
You can also create a windows service if you want the process to start without an interactive user.
|
|
|
|
|
Hi,
I'm new with C# and I've no idea to find information to solve my problem. I get this output
"RServer.vshost.exe" (Verwaltet): "C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" wurde geladen, das Laden von Symbolen wurde übersprungen. Das Modul ist optimiert, und die Debugoption "Nur mein Code" ist aktiviert.
when I try to load a Windows Form. This mistake only appears with the use of Remoting (public class remoteObject : MarshalByRefObject). While loading this Windows Form without using Remoting - everything is ok.
If you need more information, I will post it. Perhaps it is only a newbie mistake...?
Appreciative
ikm79
|
|
|
|
|
i have a class in webApplication.
when a button is click in Application. the class is called by its object and its Method.
in one method i want to load Another page. How it is possible.
code---
private void btnConnect_Click(object sender, System.EventArgs e)
{
clsLoadWebForm obj=new clsLoadWebForm();
obj.LoadPage();
}
//--------
public class clsLoadWebForm
{
public void LoadPage()
{
NewWebfrm objWeb=new NewWebFrm();
objWeb.LoadTemplate("NewWebFrm.aspx");//Not Loading a page
}
}
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
|
|
|
|
|
Please try to write a subject that works as a subject. Almost every thread here is about someone wanting help, so that is not any useful information to put in the subject.
What do you mean exactly when you say that you want to load another page? What is it that you want to happen?
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
hi,
did you try ajax panel
it may help you.
Cheers.
|
|
|
|
|
i have a class in webApplication.
when a button is click in Application. the class is called by its object and its Method.
in one method i want to load Another page. How it is possible.
code---
private void btnConnect_Click(object sender, System.EventArgs e)
{
clsLoadWebForm obj=new clsLoadWebForm();
obj.LoadPage();
}
//--------
public class clsLoadWebForm
{
public void LoadPage()
{
NewWebfrm objWeb=new NewWebFrm();
objWeb.LoadTemplate("NewWebFrm.aspx");//Not Loading a page
}
}
Sanjit.rajbanshi@wlinktech.com
Sanjit.rajbanshi@wlinktech.com
|
|
|
|