|
hello,
I want to create my own dll for textbox in .net.Please give any sample or way to create it.
thanks
Aurosikha
|
|
|
|
|
Create a class library type project.Make you own custom control.Build it and add the dll at the place where you need.
Cheers!!
Brij
|
|
|
|
|
Create a class, inherit it from TextBox , compile and build the dll.
|
|
|
|
|
hello guys!!
i have a table with a collumn datetime type, in the winform i have datetimepicker so i choose a date and save but it doesn't work here is some code..
DateTime dtime;
dtime=dateTimePicker1.Value.Date;
row["Date"] = dtime;
the dtime variable contains the date, for example 12-2-2008 12:00pm
but when i click tha save button it sais it cannot convert datetime from string
|
|
|
|
|
Its always better to use string for saving Datetime.
Cheers!!
Brij
|
|
|
|
|
Brij wrote: Its always better to use string for saving Datetime.
No. It's not a good practice.
|
|
|
|
|
You can say somewhat it's not a good practice but for better flexibility and avoid Exceptions one can use it.
It's all upto one what is one's way of coding
Cheers!!
Brij
|
|
|
|
|
Brij wrote: but for better flexibility and avoid Exceptions one can use it.
It will make your code to be prone to error.
|
|
|
|
|
Try to parse that string to a DateTime instance and supply that to the table. There are methods like DateTime.TryParse or DateTime.Parse
|
|
|
|
|
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.
|
|
|
|