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_C lick(object sender, System.EventArg s e)
{
OpenFileDialog dlg = new OpenFileDialog( );
dlg.InitialDire ctory = Application.Sta rtupPath;
dlg.Filter = ".MDB Files (*.mdb)|*.mdb";
dlg.ReadOnlyChe cked = true;
dlg.ShowReadOnl y = true;
if(dlg.ShowDial og() == DialogResult.OK )
{
this.txtBox_DB_ Connection.Text = dlg.FileName;
}
//RESET
dlg.RestoreDire ctory = true;
dlg.Dispose();
}
*************** *************** **********
//RETURN FROM TECH ZONE FOR UPDATES
private void Tech_Return(str ing Host_BackEnd,st ring Connection,stri ng
Machine_Name,st ring Station_Printer ,string Adverts,string Bar_Printer)
{
ResourceWriter Writer = new ResourceWriter( "HOST.resources ");
//
Writer.AddResou rce("HOST_BACKE ND", Host_BackEnd);
Writer.AddResou rce("DB CONNECTION", Connection);
Writer.AddResou rce("MACHINE NAME", Machine_Name);
Writer.AddResou rce("STATION PRINTER", Station_Printer );
Writer.AddResou rce("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 4715
On Fri, 01 Feb 2008 07:52:07 -0800, MikeY <mi*******@yaho o.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 RestoreDirector y _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*********@nn owslpianmk.comw rote in message
news:op******** *******@petes-computer.local. ..
On Fri, 01 Feb 2008 07:52:07 -0800, MikeY <mi*******@yaho o.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 RestoreDirector y _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 created a GraphicInput.resx file.
It there some switch or set up I can force compiler to create a resources
file?
Please shed some light on this issue, thanks in advance.
--------------------------------------------------
|
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 library project)
This class call methode :
ResourceManager MyAppResourceManager = new
ResourceManager("MyAppMain.Resources", Assembly.GetExecutingAssembly());
and I obtain error which tell that there is no propertly added
|
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
everything !
For the moment, i have created différents .aspx page and associated file
..vb.
>> "My application is not compiled yet into .dll."
|
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".
Same file path containing special characters works fine in one machine, but
doesn't work in other.
I am using following API function to get short file path.
Declare Auto Function GetShortPathName Lib "kernel32" (ByVal lpszLongPath As
|
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_
namespace Component.Windows.BSuite
#elif _Version_C_
namespace Component.Windows.CSuite
|
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, resources, they looked ok to me. I even click on
each item and they open up in pain just fine.
what can I do?
|
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 .resources file in the Soultion Explorer, the icon
has changed into the 'unknown file type' icon.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |