|
even with that it is still the same
i write
DateTime.Parse(dateTimePicker1.Value.Date.ToShortDateString());
and it says again cannot convert datetime from string
i am very disappointed ((((((
|
|
|
|
|
hi.....
I am working on a small application using C#, VS 2003. I have to check if the folder has read or write permissions to it, before i generate my output in that folder.VS 2005 has some functions for checking the folder access, but i dint get any for VS 2003. Please do let me know if there is any function check the folder permissions in VS 2003.
Thnx in advance.
|
|
|
|
|
Please don't duplicate the Qs
Cheers!!
Brij
|
|
|
|
|
hi.....
I am working on a small application using C3, VS 2003. I have to check if the folder has read or write permissions to it, before i generate my output in that folder.VS 2005 has some functions for checking the folder access, but i dint get any for VS 2003. Please do let me know if there is any function check the folder permissions in VS 2003.
Thnx in advance.
|
|
|
|
|
FileIOPermission is there since .NET 1.1. Use the Demand method to check you have access to folders. Check the following code (not tested on .NET 1.1)
bool CanWriteToFolder(string folder)
{
FileIOPermission f = new FileIOPermission(FileIOPermissionAccess.Write, folder);
try {
f.Demand();
}
catch (SecurityException) {
return false;
}
return true;
} Check documentation[^] for detailed examples.
|
|
|
|
|
Thnk you very much.
|
|
|
|
|
for some reason this doesn't work for me. The SecurityException is never thrown.
|
|
|
|
|
I have the same problem
I think the reason is that this is fileIO permissions. Not folder.
Still looking for a folder check - will update if I find something.
|
|
|
|
|
Hi,
You can try following code block to check if the directory is having Write Access.
It checks the FileSystemAccessRule.
string directoryPath = "C:\\XYZ";
bool isWriteAccess = false;<br />
try<br />
{<br />
AuthorizationRuleCollection collection = Directory.GetAccessControl(directoryPath).GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount));<br />
foreach (FileSystemAccessRule rule in collection)<br />
{<br />
if (rule.AccessControlType == AccessControlType.Allow)<br />
{<br />
isWriteAccess = true;<br />
break;<br />
}<br />
}<br />
}<br />
catch (UnauthorizedAccessException ex)<br />
{<br />
isWriteAccess = false;<br />
}<br />
catch (Exception ex)<br />
{<br />
isWriteAccess = false;<br />
}<br />
if (!isWriteAccess)<br />
{<br />
}
|
|
|
|
|
This work on local computer, how about a network shared folder(e.g.\\Server01\Files)?
I am happy to work with people doing great projects.
|
|
|
|
|
Hi,
Is there anyway to find the location of the csc.exe compiler dynamically? I am trying to automate the compilation process for which i would need the location of the csc compiler.
- kp
|
|
|
|
|
May check throgh registry if framework is installed
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
|
|
|
|
|
If you're using a managed language (vs. a vanilla script) to automate the process, I recommend using the CSharpCodeProvider class. For example, to compile HelloWorld.cs to an .exe , do the following:
CSharpCodeProvider cp = new CSharpCodeProvider();
ICodeCompiler icc = cp.CreateCompiler();
CompilerParameters parms = new CompilerParameters();
parms.GenerateExecutable = true;
parms.OutputAssembly = Output;
CompilerResults results = icc.CompileAssemblyFromFile (parms, "HelloWorld.cs");
/ravi
|
|
|
|
|
Wow! I didn't know you could do that! Five points.
|
|
|
|
|
I'm new to XML, but wat I'm trying to do is this.
I have a XML file with config settings and language items
e.g.
<XML>
<Config>
<Port>com1</Port>
<Baud>9600</Baud>
</Config>
<Language>
<Item No="1000" Text="Hello world" />
<Item No="2000" Text="Good Bye" />
</Language>
</XML>
I read the Config elements by using GetElementByTagName, so this is no problem.
I'm looking for a simmular way of selecting the language items so I can do somthing like
psedu code
Lang = XMLSetup.GetElementsByTagName("Language")[0];
XmlElement LangText= (XmlElement)Setup;
textbox.text=LangText.GetElementByAttribute("No","1000").GetAttribute("Text")
The last line selects the "value on an attribute, depending on an other attribute"
Could this be done?
If I change the structure of of my XML file to somthing like...
...
<Language>
<Item No="1000">
<Text>Hello world</Text>
</Item>
could it be done then??
Any ideas on how to format the XML and do the selection?
I'm used to work with databases, and XML could be used as a databse, or???
If you use an SQL table, you can simply do "select Text from Language where No="1000"...
Thanksfull for any advice
|
|
|
|
|
The trick to doing this is fairly easy://Item[@No='1000'] Basically, this searches for all elements from the root that match Item where there is an attribute No with the value 1000. The @ symbol is used to indicate that it's an attribute.
|
|
|
|
|
I don't follow you here...
Can you give me an example of how to write that in C#?
Thanks!
|
|
|
|
|
System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
xmlDocument.Load(@"c:\text.xml");
System.Xml.XmlNodeList xmlNodeList = xmlDocument.SelectNodes("//Item[@No='1000']");
foreach (System.Xml.XmlNode xmlNode in xmlNodeList)
{
Console.WriteLine(xmlNode.Value);
}
happy coding
regards,
mark
|
|
|
|
|
I get the following error message sometime when i Navigate to a html file through the webbrowser control C#. Has anyone every comes across while loading an html file. thanks
Action canceled
Internet Explorer was unable to link to the Web page you requested. The page might be temporarily unavailable.
Please try the following:
Click the Refresh button, or try again later.
If you have visited this page previously and you want to view what has been stored on your computer, click File, and then click Work Offline.
For information about offline browsing with Internet Explorer, click the Help menu, and then click Contents and Index.
Internet Explorer
|
|
|
|
|
Type your address in a web browser and see if that address exists or not.
When you're alone in the Dark, Fear will protect you...
|
|
|
|
|
yes i does work first it asked me for my login and password after that i tooke me to the defualt IIS page. I get that error message randomally. sometimes i do get it and someteimes i don't while running my c# app that has webbrowser control in it .
|
|
|
|
|
I have a single instance CAB application.
What I would like to have happen is when a second instance tries to run, it instead passes the argruments to currently running instance, and that instance processes those arguments.
Something like,
_mainForm.Activate(args);
I have this in my ShellMainApplication Main method
bool ok;
Mutex m = new Mutex(true, "InfinityMMSC", out ok);
// app is already running, something needs to be done here
// the running app should process the arguments
if (!ok)
{
// THIS IS WHERE I WOULD LIKE THE ARGUMENTS TO BE PASSED TO THE RUNNING APP
MessageBox.Show("Another instance is already running.");
return;
}
Is there a way to do this?
|
|
|
|
|
I am currently designing my first serious windows application, and I'm wondering whether it's worth using the DirectX libraries.
The application is going to be 2D (although I may implement some 3D elements at a later date), but I don't want it to look like a standard windows application. I'd like to use bitmap images to define the look of the program elements. I don't want the normal title bar on every window and sub-window, I don't want it to be color schemed like typical Windows forms, and there's a good chance that not every element is going to be a uniform shape. The program will need to handle lots of bitmap images simultaneously, with alpha channel support for formats like PNG. I'll also be making use of sound files like mp3s or ogg vorbis.
Just to clarify. This is not technically a game that I'm making. It's a table-top simulator, for playing games like Dungeons&Dragons. So animations and such are not really a priority.
With that in mind, I am wondering...
A) Can the standard Windows libraries handle what I'd like to do?
B) What if any benefits would I gain by using Managed DirectX in this primarily 2D application?
|
|
|
|
|
As a personal opinion I would go for WPF[^] instead of using Forms or DirectX directly.
WPF allows you to use the potential of DirectX but at a higher level.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I second that. Sounds like a great fit for WPF.
Generico300 wrote: A) Can the standard Windows libraries handle what I'd like to do?
The 2D stuff, yes - and any 3D stuff you want to write yourself.
Generico300 wrote: B) What if any benefits would I gain by using Managed DirectX in this primarily 2D application?
Is managed DirectX even supported anymore?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|