Hi everyone,
I"m having a problem with the OpenFileDialog() changing my path to save to
my .resources file. I'm a bit baffled why this is happening, even when I
set the OpenFileDialog back to the inital directory where the .resource file
resides.
What I am trying to do is get the location of my database and save it to
string format in my resource file (un-embedded). When I go to save this
information to my .resouce file it creates another resource file at the
location that I selected the database from and not the origional one. Now
this problem does not a rise when I manually type in to my textbox the
location of my database.
A sample of my OpenFileDialog() is as follows, then my Save to .resource
file:
//SET-UP DATABASE LOCATION
private void DB_Connection_Click(object sender, System.EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.InitialDirectory = Application.StartupPath;
dlg.Filter = ".MDB Files (*.mdb)|*.mdb";
dlg.ReadOnlyChecked = true;
dlg.ShowReadOnly = true;
if(dlg.ShowDialog() == DialogResult.OK)
{
this.txtBox_DB_Connection.Text = dlg.FileName;
}
//RESET
dlg.RestoreDirectory = true;
dlg.Dispose();
}
****************************************
//RETURN FROM TECH ZONE FOR UPDATES
private void Tech_Return(string Host_BackEnd,string Connection,string
Machine_Name,string Station_Printer,string Adverts,string Bar_Printer)
{
ResourceWriter Writer = new ResourceWriter("HOST.resources");
//
Writer.AddResource("HOST_BACKEND", Host_BackEnd);
Writer.AddResource("DB CONNECTION", Connection);
Writer.AddResource("MACHINE NAME", Machine_Name);
Writer.AddResource("STATION PRINTER", Station_Printer);
Writer.AddResource("COMMERCIAL", Adverts);
//JUST MORE OF THE SAME HERE
//
Writer.Generate();
Writer.Close();
Writer.Dispose();
}
I'm not sure what I"m missing or is going wrong here, so any and all help is
appreciated.
Thank you all in advance. 2 4700
On Fri, 01 Feb 2008 07:52:07 -0800, MikeY <mi*******@yahoo.comwrote:
I"m having a problem with the OpenFileDialog() changing my path to save
to
my .resources file. I'm a bit baffled why this is happening, even when I
set the OpenFileDialog back to the inital directory where the .resource
file
resides.
You need to set RestoreDirectory _before_ you show the dialog. Not after.
For what it's worth, I don't think it's a good idea for your resource
handling code to depend on the current directory anyway. You should
determine the actual path when your application starts, and then always
reference the file via that absolute path.
Pete
Hi Peter,
Thank you that exactly solved my problem. As for determining the actual
path. I shall take your advice and look into it right now.
Thanks again
MikeY
"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Fri, 01 Feb 2008 07:52:07 -0800, MikeY <mi*******@yahoo.comwrote:
>I"m having a problem with the OpenFileDialog() changing my path to save to my .resources file. I'm a bit baffled why this is happening, even when I set the OpenFileDialog back to the inital directory where the .resource file resides.
You need to set RestoreDirectory _before_ you show the dialog. Not after.
For what it's worth, I don't think it's a good idea for your resource
handling code to depend on the current directory anyway. You should
determine the actual path when your application starts, and then always
reference the file via that absolute path.
Pete
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: yongwei |
last post by:
After I make some changes to my program, I got a run time error each time,
see following.
Seems to me like the compiler did not create a GraphicInput.resources in
\obj sub dir. the compiler did...
|
by: Stefan Turalski \(stic\) |
last post by:
Hi,
What I need to do is adding some support for resources files to my
application. What I did is:
MyAppMain <- startup project
MyAppHelper <- project which has MyAppResourcesClass (al a...
|
by: fabrice |
last post by:
Hello,
I'm trying to use Resources file to manipulate language in my application
Web. I'm using vb.net and framewok 1.1.
I have read some articles about the subject. But i don't understand...
|
by: Sakharam Phapale |
last post by:
Hi All,
I am using an API function, which takes file path as an input.
When file path contains special characters (@,#,$,%,&,^, etc), API function
gives an error as "Unable to open input file"....
|
by: John Torville |
last post by:
Hi there,
Does anyone know how to add ".txt" resources file to a C# project in Visual
Studio. It should compile down to an embedded ".resources" file the same way
as a ".resx" file. Thanks.
|
by: Henry Jan |
last post by:
Hi All,
In VS2005, when I use compilation directive for namespace that contains a control Control1 class, e.g.:
#if _Version_A_
namespace Component.Windows.ASuite
#elif _Version_B_ ...
|
by: GS |
last post by:
How do I fix this corrupt resource file header problem?
Corrupt .resources file. Got an unexpected EndOfStreamException while trying
to read the ResourceReader header.
When I open up properties,...
|
by: stormogulen |
last post by:
Hi,
I have converted a project from VS2005 to VS2008, and I now have
problems accessing icons which are stored in a .resources file.
The target framework is still 2.0.
When I look at the...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |