|
Surely that is just for debugging? No? When you run the application at a real command prompt it should work? (I don't have Visual Studio in front of me right now so I cannot test this)
|
|
|
|
|
|
Hello
i am devloping an application.
but how can i search for a file
|
|
|
|
|
hi,
Use FileInfo or DirectoryInfo class in System.IO namespace.
I think now you have got the hint,use this....and reply me
nishu
|
|
|
|
|
You could search for files by writing a recursive function.
The function has one parameter - DirectoryInfo dirToCrawl - which lets the function know where to search.
<br />
public void SearchFile(DirectoryInfo dirToCrawl, string Filename)<br />
{<br />
DirectoryInfo [] subdirs = dirToCrawl.GetDirectories();<br />
FileInfo [] filesInDir = dirToCrawl.GetFiles();<br />
for (int i = 0; i < subdirs.GetLength(0) - 1; i++)<br />
{<br />
SearchFile(subdirs[i], Filename)<br />
}<br />
for (int i = 0; i < filesInDir.GetLength(0) - 1; i++)<br />
{<br />
if (filesInDir[i].Name == Filename)<br />
{<br />
}<br />
}<br />
}<br />
If you would call the function like
<br />
DirectoryInfo mysearchroot = new DirectoryInfo("C:\\");<br />
SearchFile(mysearchroot, "foo.txt");<br />
it would search all directories and subdirectories of C: for "foo.txt"...
Hope it helps,
mik
|
|
|
|
|
See an example here:
http://www.codeproject.com/cs/files/winsearchfile.asp
Utkarshraj Atmaram
|
|
|
|
|
I am using a DLL written in C in my C# project.
The original C function goes like this:
char* SomeFunction(const SomeClass someObj, const void* ptr, char* str, size_t strSize);
The value of str is changed in the function. This is how I've written in C# interop file:
Using size_t = System.UInt32;
...
...
[DllImport(DLLNAME)]
public static extern string SomeFunction(SomeClass someObj, IntPtr ptr, ref string str, size_t strSize);
While calling the function in C#, I am passing some uint value such as 1024 in place of strSize.
I am getting FatalExecutionEngineError on running the code:
Message: The runtime has encountered a fatal error.
The address of the error was at 0x79ef067e, on thread 0xfb8.
The error code is 0xc0000005.
This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code.
Common sources of this bug include user marshaling errors
for COM-interop or PInvoke, which may corrupt the stack.
I have two more functions with parameters as char* in C, and ref string in C#. The program simply terminates after the control comes to these functions.
I am wondering if there is something wrong with char* and ref string ?
-- modified at 10:05 Wednesday 6th September, 2006
Ut
|
|
|
|
|
Did you try to leave it as a normal string (without ref)?
I noticed that trying to get the memory address of a "managed" type and assigning it to a pointer will result in an exception because the compiler don't wants to.
Maybe this is the cause for your error though i don't know how this stuff works (by this stuff i mean interop and the whole com )
|
|
|
|
|
[DllImport(DLLNAME)]
public static extern string SomeFunction(SomeClass someObj, IntPtr ptr, System.Text.StringBuilder str, size_t strSize);
|
|
|
|
|
Thanks Judah! That worked!
Ut
|
|
|
|
|
is there a way to set a stastic library in c# programs like vc++ to be able to run a c#.net application on a system that has not dotnet framwork?
excuse me for my poor engelish I'm trying to learn
|
|
|
|
|
Afaik there is no possibility like that :P
You still would have to translate the IL-Code which is produced by the c# compiler to real machine instructions (guess asm ) That's why you ALWAYS need the .Net Runtime.
Maybe that has changed now so keep on googling :P
|
|
|
|
|
Hello
To make you .Net application run without the need of .Net framework, you need something like Xenocode Postbuild[^].
Regards
|
|
|
|
|
Hi,
How can i make a textbox accepting only int's and if anything else being typed ignoring it (expect a . (dot)).
Thanks in advance!
|
|
|
|
|
There are several possibilities - In case of .net 2.0 there are so called "masked textboxes" - google for it and you will find nice instructions.
You also could add an eventhandler to your textboxs OnKeyDown event and check if the char (i guess its the "KeyChar" property of the event object which is passed to the eventhandler) is an integer. if it isn't, you will have to set the event objects property "IsHandled" or "Handled" or somewhat like that to true.
This will prevent the Char from being entered in the textbox...
|
|
|
|
|
Hi,
Thank you for your reply!
Ima google that up!
|
|
|
|
|
hi, try this:
private void textBox1_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
int intKeyValue = (int)e.KeyChar;
if (((intKeyValue<48 || intKeyValue>57 ) && intKeyValue!=46))
{
e.Handled = true;
}
}
you can add any extra chars valus, just like 46(dot), you can 8(backspace)
Tamimi - Code
|
|
|
|
|
Hi Tamimi,
Thank you very much!
I'll try that!
|
|
|
|
|
I have created my a custom control which has a DataGrid in it.
I am creating a DataGridTextBoxColumn in the TableStyle as one of its columns.
Add binding with the datasource ..
I am unable to edit the columns in the datagrid displayed ...
How to make this column of datagrid editable...???
Thanx in advance
|
|
|
|
|
The Datagrid itself has a property called "ReadOnly". Try to set it to "false" manually.
This will make the fields in the DataGrid editable. Hope that's what you were talking about :P
|
|
|
|
|
|
Hi Folks.,
I have working with windows services. i want to access foxpro database from another database through services. actually .dbf is the database format for foxpro and this structure is normal file structure thats why i get confused .
If any one know abt this problem plz share with me.
regards,
ranandbe
|
|
|
|
|
Hello
Your post is quite unclear!!
ranandbe wrote: i want to access foxpro database from another database
What do you mean "Database from another database"??
ranandbe wrote: this structure is normal file structure
What structure?? What file?? dbf??
Well, if you want to connect to a Foxpro database -just like any other database- make an OLEDbConnection object with the proper conection string.
look in ConnectionStrings.com[^] for that.
Regards
|
|
|
|
|
Hi thank u for reply,
i have successfully connected the foxpro database through oledb in windows services. but i need the functionality to access the databse from the another one computer(by using services and the same foxpro database). Is this posible if u have a knowledge about this please share with me.
ranandbe
|
|
|
|
|
Hi every one,
I have an application that it is writen by VB.I have anothert application that it is writen by C# and is added to My VB project .I defined some global variables in vb and I'd like to use them in C#,how can I use them?
please guide me .
yours Sincerely,
Orchid
|
|
|
|