|
Hi,
I can see similar thread Here[^]
Please let me know if it not works...
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
hi,
Thank you very much for your help .
I have done, i using "invoke and delegate"
Invoke(new MethodInvoker(delegate {
listBox1.Items.Add(value);
}));
|
|
|
|
|
Nice...
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
|
I am trying to click a button programmatically.
If I click the button with my mouse it works fine by going out to the internet and asking for info the website thens sends the info requested.
However I have this on a timer (DelegateTimer, found here)
When the timer sends the request to "ButtonUpdatesPerformClick()" the .PerformClick does not work below.
I cannot bypass the button by going to "NonButtonUpdates()", because when it goes out to the internet, the information never comes back.
Can anyone help me with this problem.
Thanks in advance.
Michael
delegate void SetUpdatesCallback();
public void ButtonUpdatesPerformClick()
{
if (this.buttonUpdates.InvokeRequired)
{
SetUpdatesCallback button = new SetUpdatesCallback(this.ButtonUpdatesPerformClick);
this.Invoke(button, new object[] { });
}
else
{
this.buttonUpdates.PerformClick();
}
}
private void buttonUpdates_Click(object sender, EventArgs e)
{
this.NonButtonUpdates();
}
private void NonButtonUpdates()
{
this.GoToWebsiteGetData();
}
modified 20-Nov-12 22:59pm.
|
|
|
|
|
Your code makes zero sense. Have your click handler call a private method with no arguments DoStuff() for example. You don't want to click the button programatically, now do you? Do you actually want the button to press itself visually as if by magic? Probably not. You just want the code behind it to execute. So your timer or whatever would also just call the DoStuff() method directly.
modified 21-Nov-12 12:50pm.
|
|
|
|
|
You can call your click Event in simple method whenever you required.There is no need of button click.
|
|
|
|
|
I created a custom combo box class, which inherits from the built-in System.Windows.Forms.ComboBox class. I changed the AutoCompleteMode property to be AutoCompleteMode.SuggestAppend, which is working just fine. However, I would now like to capture the up & down arrows, only when the auto complete dialog is NOT open, to allow a client to cycle through all of the drop down options without opening the dropdown (in my custom control, the Items property is an empty collection, and my dropdown is done using a ToolStripDropDown).
Currently, I have overridden the ProcessCmdKey method, since the KeyDown, KeyUp, and KeyPress events are not being fired once the auto complete dialog has been opened (even if it is closed at a later time). The problem is that I can't figure out how to tell if the auto complete dialog is open. If it is open, I want to use the default behavior implemented in the base class. If not, I want the drop down to cycle through the available options.
I have looked through the Windows messages using Spy++, but can't figure out which one is causing the auto complete dialog to open & close. Some of the suspicious ones are (WM_USER + 7441), LB_FINDSTRING, LVM_GETNEXTITEM, and LVM_SETITEMCOUNT when it opens, and LVM_SETITEMSTATE when it closes.
Should I watch for these messages within the WndProc override, and maintain a boolean between the LVM_SETITEMCOUNT and LVM_SETITEMSTATE? Should I query all open classes of type ComboLBox (the type that is being displayed in the auto complete; the problem is that the parent is the desktop for this type)? Is there some better way to query whether the auto complete dialog is open?
Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Is there a way to return the full path name of the file containing the code?
suppose I have the following class in the file c:\myproject\CA.cs
public static class A
{
public static void Show()
{
string myFile = ....
Console.WriteLine(myFile);
}
}
modified 20-Nov-12 17:08pm.
|
|
|
|
|
The only possible reason I could see for you doing so, is if you're working on some sort of dynamic plugin system and you're going to compile/interpret/load the file at runtime - in which case you need a system to register where you're going to look for the code/plugin/etc
Once your code is compiled into an exe or a dll, you can find the path to the executable module or where it was loaded from, but not to a single piece of code - What would be the point, hmm, if a compiled module couldnt be shipped to a seperate machine/location, but that compiled module still had to retain a reference to the source code ?? yuck ??
Maybe Ive mis-interpreted what you're asking
|
|
|
|
|
You can certainly get the fully qualified name.
There might be some method in the Assembly which loaded the class which might provide a path name but I doubt it would be a fully qualified one. (I don't feel like looking at the docs at the current time.)
Your version control system might have 'variables' (or macros, etc - the name is always different) that allows it to insert the path into the source code when you check it in. If so you could create string with that. Of course you would need to do it on every class.
|
|
|
|
|
The best I can think of is the stack trace, but it's probably not worth the trouble.
Remember that a class can be partial or inherit members from base classes.
If you really want to, you could add an Attribute to the class, but you'd have to weigh the costs and benefits of added maintenance.
It still comes down to why you want the information.
|
|
|
|
|
The reason it that the class has a method that should be able to copy its source file whatever it is.
An alternative solution i found:
1) create each file containing one only class so that the file is the class name
2) implementing a method (in a base class that will be overrides), which get the text class name,
and build a name of file (classname +".cs"). Then starting from root directory of project, it will search for the file name in the sub directories..
a workaround.. but it should work
|
|
|
|
|
You still haven't really explained why. Why do you want to copy the file?
And what happens if the app is installed on another system or otherwise separate from the source?
Include the file name in a config file?
Could you include the source as a resource in the app?
Or in an install package?
|
|
|
|
|
it is an utility I use only during the developing, only to copy the file containing the specific class to a specific directory. I don have to distribute it.
This is way: I don ' want to look for the class and do copy and paste of the file manually
|
|
|
|
|
Sounds like a lot of hard work for no particular benefit. You can probably do this more easily within Visual Studio during your build processing.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
If you're using the functionality of this class again and again, why not put it into a class library and reference that instead? That way you don't have to copy/paste.
|
|
|
|
|
|
we need to create a application which has a pin button on title bar.
if its clicked the application should get hide on top of the desktop as like connection bar in remote desktop application.
can some one pls tell me how to do that... mearly searched for 1 week but still could't find. connection bar example []
|
|
|
|
|
How to write dataset to mpp file
|
|
|
|
|
Hi fellows, a question from my side again! Would really need your expertise!
Is therer a way (maybe with Reflection) to get the definition of a Function?
Description:
I have a self defined Function (yeah I know dynamic, but here it's really neccessary, would take too long to explain):
dynamic func = new Func<int,int>((int i)=>{return 2*i;});
Chance to get to display the part {return 2*i;} programatically? (something like
MessageBox.Show("Function Code: {0}", functionCode);
(int i)=>{return 2*i;} would be fine as well, just if it makes any difference
Thank's in advance!
|
|
|
|
|
|
Thank you for the link, although it seems what I need to achieve cannot be done - at least not with C#. Looks like I have to save the function definition in an attribute.
D'oh
|
|
|
|
|
I want to get an exception when I am running a program on virtual machine. I use VIX API and RunProgramInGuest...
try
{
vmx.RunProgramInGuest(@"C:\Windows\system32\My
Program.exe", "", true, false, false);
}
catch {....?}
Thank you
|
|
|
|
|
I'm not sure you can just catch exception from another process just like that if MyProgram.exe isn't aware of what you want to do.
To be honest, this scenario isn't much different on catching exception from another process on other physical machine or even on the same machine.
If you have control over MyProgram.exe you can write its default error handler to notify your main application on any exception. For hints look there http://lmgtfy.com/?q=inter+process+communication[^] and especially on http://msdn.microsoft.com/en-us/library/windows/desktop/aa365574(v=vs.85).aspx[^]
Hope this helps.
--
"My software never has bugs. It just develops random features."
|
|
|
|