|
Hello to all you pro's,
I have a small problem i don't understand.
I have a constructor, in which i initialize some of my object members,
after that I wanna call btnOK.performClick() in order to call the buttons click event handler.
this is a login screen which I want to be able to run threw batch file.
I pass to Main the user and password, but it waits for a user to click OK.
I wanted to make it full automatic so inside c'tor i wrote btnOK.performClick().
this doesn't work, this program doesn't jump to the handler. what can I do about it????
here is some relevant code, don't hesitate if any more data is required.
thank you all for your help.
in Main()
if (!EltavGateway.Properties.Settings.Default.UseDefultLogin)
{
frmLogin frmLoginUser = new frmLogin();
if (frmLoginUser.ShowDialog() != DialogResult.OK)
{
return;
}
}
else
{
frmLogin frmLoginUser = new frmLogin(args);
if (frmLoginUser.ShowDialog() != DialogResult.OK)
{
return;
}
}
in function
public frmLogin(String[] args)
{
InitializeComponent();
//if the flag for automatic login is flagged true, then check that main was
//passed arguments for login(run from batch file). if not, go to regular login.
//enter an existing user and password
if (args.Length == 2)
{
tbName.Text = args[0];
tbPassword.Text = args[1];
this.btnOK.PerformClick();
}
}
P.S
sorry for the code presentation but for some reason I can't use the labels "pre" and "code",
since it tells me I am leaving the page and loosing all data.
|
|
|
|
|
Why are you even clicking on the button?? Don't bother.
Move the code that's in the OK button's click event to it's own method, say you call it PerformLogin, then call it from where you have your current PerformClick line. Obviously, remove this line since it's useless to you.
Rewrite your OK buttons click event handler to call this same method with the appropriate parameters.
|
|
|
|
|
thanks man,
my problem appeared to be in some other place in my code,
but you really pointed me in the right direction.
thank you very much for your time and help.
really appreciate it.
have a great day.
|
|
|
|
|
Visual Studio 2005 Proffesional edition does not want to debug my .NET program because 'The Binding Handle Is Invalid'. I tried to disable Visual Studio hosting process and it worked for C# desktop app. BUT I cannot do it in ASP .NET project (there isn't such option).
After hours of Googling I found the same answer everywhere: I have to turn on 'Terminal Servises' or set it to the 'manual' mode. Unfortunately I cannot perform that -- I get a message "The service cannot be turned on because it is turned off or some of it's dependencies are turned off" (translation from Polish, don't know exact english version). And yes, RPC is enabled.
Please help. I would like to learn ASP.NET but it is difficult without debugging. Of course it is possible anyway but if I have $10.000-level MSVS I do want to use it's capabilities.
Reference:
[^1]
[^2]
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
There is no App_Code folder when I try to create a new ASP.net folder for my project.
Please help me.
Thanks
|
|
|
|
|
ss.mmm wrote: There is no App_Code folder when I try to create a new ASP.net folder for my project.
Please help me.
Right-click the website item in the Solution Explorer. Go to 'Add ASP.NET folder' and select 'App_Code'.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi All,
Please help me to find a way to kill a process(say cmd.exe) running on network machine.
I have admin rights on one machine and I am only able to get the process running on client machine but when i go to kill any of the process i am caught with access denied or action not allowed kind of exceptions. (I think Process class will not serve here)
Please help.
Thanks in advance
vivek
v
|
|
|
|
|
You can't. The account your code is running under must have admin rights to the target machine in order to kill the process. There is no way around this requirement.
|
|
|
|
|
yes I have the admin rights.
please guide me on this.
thanks in advance.
v
|
|
|
|
|
Hi All,
I am able to kill the process on remote machine but sometime i get RPC Server not running/available exception.
Anybody knows how to overcome this problem ?
Thanks in advance
v
|
|
|
|
|
Hey guys
I have a few cool ideas for a chord book app for musicians. The idea behind something like this is pretty basic, you are anchoring chords above text. The problem is that I come from a web background, and I have no clue where to even start with something like that.
What I would like to be able to do is drag an image from a pallet over some text. When it is over the text, I would like something like the text cursor to appear in between individual characters. Once the mouse is released, I would like to display that image anchored over that bit of text (so after dragging a chord, if the user goes to the start of the line and types more, the image will move with the text). I would also like to be able to do some typesetting for printing (to be able to put the chord names in a line above the text, but have it anchored again. simple with monospace, but I want to support not monospace fonts for printing)
I have no clue where to even start looking to make stuff like this. If anyone could point me in the right direction, it would be greatly appreciated.
|
|
|
|
|
To make things easier for yourself, stop thinking about the application as a whole. Pick one aspect, and break it down. For example:
Draging an image.
Click on image, move image, release image.
Events: mouseDown, mouseMove, mouseUp.
On mouseDown, get the picture that is below it.
On mouseMove, draw the picture at the location of the mouse.
On mouseUp, get text that is below image, attack image to text.
...
Then, you break that down:
On mouseDown, get picture.
Add an onClick event to each picture, so that you know which picture has been clicked
...
And so it will go on.
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
Hello, I am new to programming. This will be my second C# programming class. I am very confused on using Visual Studio C# apps. In our class we write C# console apps. I need some help understanding how things are saved and how ro test your code. my example
I start a new project as a C# console app:
I write my code, before I save it I can test the code by going to debug and the code will run. If I have errors it will come up if not the output is shown. Now here comes the part. When I save it I save it as a file and not a project or a solution. It saves but then to totally close the code out I must close the solution. I chose to discard and exit. Now I am able to open up a new project or open up and existing file or project.
Now I need to change some code to my C# file I just wrote and saved. I open it and and it brings it up. Everything is there. I now make some changes. Now I want to test the code. HOW DO I DO THIS.Ths debug menu is not an option. it si not highlighted. What am I doing wrong?? I am saving the code wrong as a file. What do I need to do. I have been having to open the exiting file, copy the code, close that file, open a new project console app and then paste the code in the new window and there I have my debug option nice and highlighted and I am able to test my code that I had to make changes to. I know there is another way. HELP PLEASE. Thanks in advance,Darren
|
|
|
|
|
dxladner wrote: Now I need to change some code to my C# file I just wrote and saved. I open it and and it brings it up. Everything is there. I now make some changes. Now I want to test the code. HOW DO I DO THIS
You do it by NOT doing this:
dxladner wrote: When I save it I save it as a file and not a project or a solution.
You MUST save the entire solution so the entire set of projects, plus all supporting files gets saved.
I have no idea why you would save just the *.cs file and not the entire solution.
|
|
|
|
|
Thanks Dave for the quick reponse. This works great. One other question. Can you elaborate on the solution vs the project vs the differnt files?? or direct me to a link with some good clear explanations.Thanks, Darren
|
|
|
|
|
A solution contains many projects which contains many files. All programs are stored in a project and has many files. Sometimes your application might depend on other code that you want to debug at the same time, so you add both projects into a solution.
I hope that explains the relationship a little.
|
|
|
|
|
Hi,
I have this:
int a = 5;
int *p = a;
Ho can I delete the pointer.
Thank you.
|
|
|
|
|
What do you mean? There's nothing here to "delete". It would appear that you're comming from a C++ background and trying to use pointers the exact same you did before. C# does support pointers, but not to the extent that C++ does.
|
|
|
|
|
Hi,
I use unsafe code - I am able to work with pointers(I think).
|
|
|
|
|
Yeah, with pointers, unsafe code is a given.
You haven't answered anyones questions about what you're trying to do with this.
There is no such thing as "deleting" with a pointer in C#.
|
|
|
|
|
I'm not sure that you need to, C# has that garbage collection thing. Where it clears memory that's not being used every now and then.
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
C# has the garbage collection I agree with you.
But I have to use usafe code. when I turn it on, wil garbage collection still work?
|
|
|
|
|
daavena wrote: But I have to use usafe code. when I turn it on, wil garbage collection still work?
Yes, it will still work. However, remember it is non-deterministic. If you are using pointers into the managed heap you need to make the pointer <a href="http://msdn2.microsoft.com/en-us/library/f58wzh21(VS.80).aspx">fixed</a>[<a href="http://msdn2.microsoft.com/en-us/library/f58wzh21(VS.80).aspx" target="_blank" title="New Window">^</a>] to ensure that garbage collection does not occur on the object you have a pointer to (remember the garbage collection process will also attempt to defragment the heap, so even if the object isn't being collected it may be moved around).
So, once you are finished with your object just ensure it is no longer fixed and allow the managed reference to the memory go out of scope and the garbage collector will get it. If you are encapsulating some piece of native code into a class you may want to look at the IDisposable interface as a way of cleaning up resources when an object of that class is no longer required. This is especially important if the native code did the memory allocation rather than you allocate memory then pass it to the native code.
|
|
|
|
|
C# has the garbage collection I agree with you.
I have to use usafe code, when I turn it on, wil garbage collection still work?
|
|
|
|
|