|
Hello Dave,
First, thank you for your time again!
I think there was a lot of misunderstanding from my side regarding to your words (like: fully qualified), because of my poor english and/or my programing skills! I actually was thinking that you don't like any kind of combining pathes for finding the exe path. Thats why I made that kind of long(useless) explination try before.
But I think there is one very important point for me which was not answered correctly, or maybe it was a wrong explination from my side.
I wrote: Is there a designtime support for that?
Means, all the other ways (apart from System.Inviroment.CurrentDirectory) brougt me an obscure path at design time.
Dave Kreskowiak wrote:
OK. So your application builds the absolute path from Application.StartupPath and the relative path stored somewhere:
Dim path As String = Path.Combine(Application.StartupPath, "\subfolder.file.xml")
This will hold true and work no matter what folder the customer copies the .EXE file and subfolders/files to.
Ok. But I tested it for my designtime needs, and it is not working!
The problem is that most methods or properties returning pathes like: "C:\Programe\Microsoft....\VS2003\Common7\IDE", instead of: "C:\MyFolder\...".
"System.Enviroment.CurrentDirectory" is the only property I found which works during run- and designtime in the same way.
Dave Kreskowiak wrote: THere is just about never a reason to depend on CurrentDirectory unless you're writing some kind of commandline utility.
Please let me know if this is still your last word, after my try to explain my problem a little better.
So, again thanks for your time and patience!
All the best,
Martin
|
|
|
|
|
Hello,
If you whant to have the path to the exe file, you should use:
System.Environment.CurrentDirectory
All the best,
Martin
|
|
|
|
|
That doesn't necessarily return the directory the .EXE is in. If the .EXE file is double-clicked, it will most likely be the corret folder, but if it was launched from a shortcut, the shortcut can specify a different directory than the one the .EXE is in.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Do you mean, we should care about the shurtcut directory?
Never needed that.
Or do you think, that then the shurtcut directory is shown?
Don't think so.
All the best,
Martin
|
|
|
|
|
Where I work, sadly, it's common to have a different path in the Working Directory, or Start In folder on XP shortcuts, than the path to the .EXE. The CMD equivilent of launching that shortcut goes something like this:
C:\> CD workingDirectoryPath
workingDirectoryPath> <pathToExe>\Executable.exe
The current directory, as returned in your code is workingDirectoryPath, not pathToExe.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello Dave,
Thank you for the info!
I didn't even know that this is possible.
All the best,
Martin
|
|
|
|
|
Doesn't the OpenFileDialog.RestoreDirectory property do the trick?
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
hi every one ,
I'm working in C# 2.0 windws application and I wanted to know how can me make this happen u knnow. like forexample there is a login form and the user enters teh user name and password and then presses the enter key and it acts the same way as the button click event does, hope u got my point
thanks in advance
Rocky
|
|
|
|
|
Set the AcceptButton property on the form to the button that you want pressing. If you have a Cancel button, you can trigger that with the Cancel property.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello,
Don't know if I understand you write.
But I think in this case, in the TextBox for the password or in both Textboxes (name and password) there is the KeyDown or KeyUp event watched.
like this example with two textboxes and one button:
this.button.Click += new System.EventHandler(this.button_Click);
this.tbName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox_KeyDown);
this.tbPassword.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox_KeyDown);
private void Validating()
{
}
private void button3_Click(object sender, System.EventArgs e)
{
Validating();
}
private void textBox_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyCode == System.Windows.Forms.Keys.Enter)
{
Validating();
}
}
Hope I got you write!
All the best,
Martin
|
|
|
|
|
Whoa! Overkill!
myForm.AcceptButton = buttonOk;
That's all that's needed. Then pressing enter will process any code that is in your buttonOk.Click eventhandler method.
|
|
|
|
|
OK,
Never worked with this.
But if the focus is on the textbox, does the Form react also?
Or do you have to set KeyPreview to true additionaly?
All the best,
Martin
|
|
|
|
|
No, the focus can be anywhere on the form
|
|
|
|
|
Thanks!
Maybe I need it someday.
All the best,
Martin
|
|
|
|
|
I have a C# windows application...
MY DESIGN:::
IP Address- textbox
Port number- textbox
Msg to server-textbox//client msg to be searched in d xml file
Connect and Send-Buttons
Msg from server-textbox//Display corresponding reply from xml file thro TCP server.
I need to Create a TCP Client server, where the client windows gets the request to the server, searches and fetches the corresponding reply in an XML file, and displays it to server window n also to the client window as a note of acknowledgement...
CAN SOMEBODY HELP ME WITH A CLEAR CODING????? Im on my final project... i need this small task...
|
|
|
|
|
wrote: CAN SOMEBODY HELP ME WITH A CLEAR CODING????? Im on my final project... i need this small task...
What you're asking for is so trivial to do, I'd suggest you read about XmlDocument and Sockets.
It sounds like you're asking us to do your project for you. We don't get the grade, YOU do. I'd suggest you figure out how to do it yourself.
Marc
Thyme In The CountryPeople are just notoriously impossible. --DavidCrow There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith
|
|
|
|
|
Tats nice!!
But the thing im not able to do is merging...I hav a tcp request reply of the sort in a windows application... i hav done an XML read document already. but if u can merge for me a simple logic which im waiting for, it would be more sensible..
Keep Smiling Bcoz it costs Nothing-
Janani Vaithyanathan
|
|
|
|
|
Hello All,
I'm using a GridView in Windows Form. I have one Column which is of type ComobBox. I'm able to assign values in ComboBox but i'm not able to set default value to it. eg: Suppose there are 5 values say a,b,c,d,e. Now i want to set a as defualt value. this value may change depeding on conditions.
Any help will be appreciated. Thanx in advance.......
Regards,
Rahul
|
|
|
|
|
get the control reference first and try setting the default value to the one u want. Something. cmbbox.selecteindex[0]='ab';
|
|
|
|
|
hi,
thanx for ur reply. there is no such property called combobox.selectedindex[0] in DataGridView
Regards,
Rahul Pawar
|
|
|
|
|
I'm using Leon v Wyk's sample code to send a fax and I was successful to send the fax. However I will be sending around 60 fax an hour and I have added a new Modem with another telephone line to my computer. How can I check this code if Modem 1 is busy to use Modem 2?
|
|
|
|
|
hello fellow Brains
i'm trying to find the number of occurrences of a particular character in a string.
How can i do it???
|
|
|
|
|
myString.Length()-myString.Replace(myChar.ToString(),"").Length()
will do it,
and I am confident some regex expression could do it too.
Luc Pattyn
|
|
|
|
|
Oh Brainy one!
How do i replace a character only till its second last occurence? i.e. leave the last occurence of a character in a string as it is?
|
|
|
|
|
Use LastIndexOf, then do a replace on the substring up to that point.
|
|
|
|