|
Add a config file to your console app and put the connection strings in there
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
yes, i know.
but the problem is that the ConfigurationManager isn't visible globally in the console app, as it is in the web app. so, even if the ConfigurationManagerdoes have the connection string, the DB code can't get to the ConfigurationManager.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
right click project -> Add References
Scroll down to System.Configuration
Click OK
Its now accessible
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
|
|
Actually, I think your problem is real simple. It's just that you didn't get the config file where it needed to be. You can add an app.config to your project, but it doesn't do anything for you until it's copied out to the directory where your .exe is and renamed. Like my exe is TestConfigManager.exe, so I have to copy my app.config out to where that is and rename it to TestConfigManager.exe.config. I usually just write a postbuild to handle it.
www.logifusion.com
|
|
|
|
|
you're exactly right.
i was assuming the documentation for ConfigurationManger.OpenConfiguration (or whatever that member is called) allowed you to specify the config file you wanted to use. apparently, it doesn't. once i renamed, and changed that call to use the EXE's name, it all worked.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
If you add the configuration file to the project via VS .NET (Application Configuration File), then it does the copying for you.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Greetings:
I am looking for a way to embed the date and time of the build of my Visual Studio 2003 C# application. That is, I would like to have some strings in my code that are automatically set at build time with the system date time and will provide me with an easy way to display the build date and time in an "About" box at run time.
Thank you in advance,
Mark
-- modified at 9:53 Tuesday 23rd May, 2006
|
|
|
|
|
As far as I know, you can only get the creation time. There are no embed datetime in file.
FileInfo fi = new FileInfo(Process.GetCurrentProcess().MainModule.FileName);
MessageBox.Show(fi.CreationTime.ToString());
|
|
|
|
|
System.DateTime.Now.ToString() -> this returns a string with the date and time of the windows at run.
|
|
|
|
|
Thanks but, it is not current time I am looking for. It is the BUILD time of the project. In standard WIN32 under "C", you can define these MACROS:
#define _COMPILE_DATE
#define _COMPILE_TIME
These macro's are updated with the system date and time by the compiler pre-processor when the file is built.
Cheers,
Mark
|
|
|
|
|
|
I don't think you can really embed that kind of information. You could do something tricky like make a batch file that writes the current date/time to a file that is an embedded resource in your assembly. Call that batch file on prebuild and then you can use Assembly.GetManifestResourceStream to pull the contents of that file out and get your date.
If you're interested, CruiseControl has a labeler that will mark the build version as the date:
http://confluence.public.thoughtworks.org/display/CCNET/Date+Labeller[^]
www.logifusion.com
|
|
|
|
|
You could easily do this with Visual Studio 2005 which utilizes MSBuild files which are pretty easy to work with; all you have to do is modify your .csproj file. However, this only works for VS2005, as 2003 does not use MSBuild AFAIK.
You *might* be able to pull this off using pre-build steps, but I'd rather not comment on how, as that is nothing trivial.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Islamic Domination: Coming to a Jewish state near you!
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Hi,
I'm trying to place a control onto a form behind a picturebox. Some area's of this picturebox
are defined as transparant. Now I run into the problem of not seeing the controls anymore.
What does happen is the transparent area is taking the same color as the form so it looks transparant but not truly is. What am I doing wrong?!
thanks in advance
Here is some sample code..
<br />
Bitmap bmp = new Bitmap(this.ImgBackground.Image); <br />
bmp.MakeTransparent(Color.FromArgb(255,0,255)); <br />
this.ImgBackground.Image= bmp;<br />
|
|
|
|
|
set yourPicturebox.BackColor = Color.Transparent
|
|
|
|
|
Hello, everybody!
I have a little problem with a form... i have a datagrid binded to a database. i added one buttoncolumn called delete. What is the event to call when the delete button is clicked? or how do i know when the button is pressed? i've found no suitable events for the datagrid.
Thanx a lot!
|
|
|
|
|
How can I resize a panel according to form size?
I have the ff code:
this.pnlGrndWv.Size = new System.Drawing.Size(this.Size.Width,this.Size.Height);
This worked but what I actually wanted was to capture the size of form(with the excess page which i can view using scrollbar), I mean I want to know the size of the "long" windows form, I want to actually simulate ng Panel size to "real" form size. How can I do this? Thanks!
|
|
|
|
|
Use this :
this.pnlGrndWv.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
|
|
|
|
Good day everyone,
I need to design and implement a Class Library project for the Heap data structure.
Is there anyone know where I can have a reference or a sample project?
If you're interested in, pls help.
Thanks so much.
eric
|
|
|
|
|
|
I've created a custom control that uses ControlStyle.BackBuffer ControlStyle.User etc...
And i show a marquette when i move the mouse.
the problem is if i use ControlStyle flags the control doesn't flicker but the it is impossible to see the marquette, if i doesn't use ControlStyle flags the marquette is showed correctly an it follow the mouse but the control flicks.
Whow can i avoid the flickering drawing also the marquette?
|
|
|
|
|
I assume you are using CreateGraphics to obtain a Grpahics object to draw your marquette to. You should in this case instead fill some field with the info on where to draw the marquette and call Invalidate to initiate a complete redraw of the control. Than in OnPaint you can also draw the marquette.
If this is too slow because the painting function is very complex you will have to paint into a bitmap first and then draw this onto the control. While only the marquette is changing you could always just draw the bitmap + marquette.
|
|
|
|