|
Example: you need a path for a file you'll need throghout the code.
And there are other examples.
Many other examples...
Joaquim
|
|
|
|
|
|
That is a good candidate for something that should be in the app.config file. I have a configuration class in my applications that convert and cache the values from the config file so they are available throughout. In fact, I often have several configuration handling classes because the application has many subsystems that need handling separately.
|
|
|
|
|
And how do you know where is the config file?
(I also use config files, the reason to start this discussion is my config file, i need to know where it is)
Joaquim
-- modified at 19:05 Friday 6th April, 2007
|
|
|
|
|
joaquimc wrote: And how do you know where is the config file?
It is in the same directory as the executable. It will have the same name as the EXE with a .config extension added. You can override that, but that is the default for .NET applications. Or are you not using the builtin configuration classes for some reason?
If you are not using the inbuilt method then how would you be intending to populate the initial value of your global variable?
|
|
|
|
|
The app.config file defaults to being in the same folder as the .EXE. If you didn't want to use the inbuilt configuration handler classes, it's a trivial matter to get the app's, or any assembly for that matter, path that it was loaded from. For example, Application.StartupPath returns the path to the folder that the .EXE was launched from. Couple that with Path.Combine and you can build a fully qualified path to any file or folder in your application.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
joaquimc wrote: you need a path for a file you'll need throghout the code.
You actually made the mistake of hard coding a path?? I'd store that in a config file and create a static class that retrieved that path from the config file.
joaquimc wrote: And there are other examples.
Many other examples...
None of them good, I'm sure.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
What is the app.config file, can you give me an example of its use?
Joaquim
|
|
|
|
|
|
Is there any Visual Studio utility/addin for editing comments in a c# application?
There is an addin for VC++ see http://www.codeproject.com/macro/CommentsWorkbench.asp, but I could not find any for c#.
|
|
|
|
|
I am not sure about that.
But in Visual studio there are lot of controls are there.
Have a look at this[^]
Regards,
Satips.
|
|
|
|
|
There used to be a little tool by Lutz Roeder[^] that was great for that... I'm not seeing it now. He used to have Reflector and Documentor. I can't find it now, but I have a copy of it. Mail me at boneheadiii@hotmail.com and I'll send you a copy.
|
|
|
|
|
Actually, I take that back... What this does is shows you what your comments will look like in documentation. It doesn't automatically add them to code for you or help you write them.
|
|
|
|
|
I have found a really good software for editing XML comments within visual studio. I am going to try the trial version which you can use for 14 days. Has anybody tried that??
Take a look
http://www.helixoft.com/vsdocman/overview.html
|
|
|
|
|
Looks interesting, I may have to try it out.
|
|
|
|
|
Here is my situation. I have several controls on a form that I would like the end user to be able to drag around the form. However, the DragOver Event in the DragDrop Event handler does not appear to resample the points on the screen adequately while the control is being dragged around the form. As a result, the dragging needs to occur until the cursor reaches the edge of the control and the cursor has just touched the form before it is again dragged. This creates a jerky type of movement where the control is readjusted only when the cursor touches the form.
Please, somebody kindly provide some hints as to how I could get the dragPosition coordinates to be resampled so that the cursor does not need to touch the form before it is again moved on the form.
The code for the DragOver Event handler is as follows:
private static void _ctrlParent_DragOver(object sender, DragEventArgs e)
{
if (DragDropHandler.CanDropHere((Control)sender, e.Data))
{
Control cthis = (Control)sender;
e.Effect = DragDropEffects.Move;
Control ctrl = DragDropHandler.GetControl(e.Data, true, true);
try
{
if (!(ctrl is IDragDropEnabled))
{
return;
}
if (cthis.Name != ctrl.Name)
{
ctrl.Parent.Controls.Remove(ctrl);
ctrl.Parent = cthis;
cthis.Controls.Add(ctrl);
ctrl.BringToFront();
Point NewLocation = cthis.PointToClient(new Point(e.X, e.Y));
ctrl.Left = NewLocation.X - dragPoint.X;
ctrl.Top = NewLocation.Y - dragPoint.Y;
}
}
catch (System.Exception ex)
{
MessageBox.Show("Here is the DragOver Error: " + ex.Message + " The ctrl.Name is " + ctrl.Name + " and cthis is " + cthis.Name);
}
}
else
{
e.Effect = DragDropEffects.None;
}
}
|
|
|
|
|
Anyone have any inside on a pogo or Yahoo auto player, how someone would be able to read the applet window, maybe using ocr. Or poker bots, Any info would be greatly appreciated, there are lots of companies that have pogo cheats, but i cant seem to grasp where to start, I tried tcp/ip packet monitoring, but found nothing interesting.
As well is there any way i can load a java applet from a website on a C# form.
|
|
|
|
|
I am having problem connecting to oracle using DSN/ODBC. It gives me the error tns-error: unable to connect to the destination.
But if I use excel to connect to oracle using same DSN it works fine.
Application is on the same machine from which I tested using Excel.
Any thoughts...
-----
|
|
|
|
|
See if you can connect using this method:
http://www.codeproject.com/useritems/C__Instant_Oracle.asp
|
|
|
|
|
Thank you Paul. The problem fixed after updating the ODBC driver on the machine, it had old ODBC driver.
Anyway I appreciate your response.
-----
|
|
|
|
|
how can i crack MICROSOFT windows ?
pouyan
-- modified at 14:27 Thursday 19th April, 2007
|
|
|
|
|
Play with Crackers or try with Hydrogen bomb.
Regards,
Satips.
|
|
|
|
|
You could throw rocks at it.
only two letters away from being an asset
|
|
|
|
|
hold opposite sides of the CD in both hands, and then rotate your arms so that the palms of your hands are touching without adjusting your grip on the CD.
--
CleaKO The sad part about this instance is that none of the users ever said anything [about the problem].
Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
|
|
|
|
|
Use your knowledge and skill... wait.... never mind
led mike
|
|
|
|