|
|
Thanks a lot!! I've maid it )
|
|
|
|
|
You are welcome
|
|
|
|
|
My problem started off with a simple directory copy. I needed to copy the directory to another location. After creating the directory, I used the following code to set up permissions correctly. That worked great! It seemed too easy...
DirectoryInfo dirSource = new DirectoryInfo(sourceDirectory);
DirectoryInfo dirDest = new DirectoryInfo(destinationDirectory);
dirDest.SetAccessControl(dirSource.GetAccessControl());
Now I find out that my destination is a named pipe. This breaks the .NET framework implementation. So I started down the path of using the API. I found the Kernel32 CreateDirectory command to create a directory over named pipes. The documentation there isn't great. (I would like to update it with more information when I'm done.)
[DllImport("kernel32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool CreateDirectory(string lpPathName, IntPtr lpSecurityAttributes);
I can't seem to find a way to get an IntPtr to the security attributes of the current directory from the .NET framework. Is there a simple way to do this that I'm missing? The .GetAccessControl() method of a DirectoryInfo object doesn't return anything like an IntPtr.
Any ideas/help/suggestions on how to use the API call to create the directory and apply the source directory's Acccess Control items would be awesome.
Thanks!
Hogan
|
|
|
|
|
<iframe id="simpleEditor" runat="server"> </iframe> <br />
<br />
On Page_Load event how can i set the default value of iframe. Do i need to call a javascript function to the set the value if so how can i call a javascript from the .cs file or code behind file.<br />
<br />
Thanks
|
|
|
|
|
look the answer in asp.net forum
-----
|
|
|
|
|
Hi All,
I have a group of radio buttons, and I am trying to determine which is checked. I access the Group Box container, but I can't find the collection for accessing the radio buttons. I want to do something similar to:
RadioButton b = (RadioButton)groupBox.Selected();
string s = b.Text; As always, any help would be appreciated.
Thanks,
Jeff
The following does not compile with the error, "error CS1579: foreach statement cannot operate on variables of type 'System.Windows.Forms.GroupBox' because 'System.Windows.Forms.GroupBox' does not contain a public definition for 'GetEnumerator'":
foreach (RadioButton b in grpDestination)
{
if (b.Checked)
{
...
}
}
|
|
|
|
|
Try something like this:
foreach (Control control in grpDestination.Controls)
{
RadioButton radio = control as RadioButton;
if (radio != null && radio.Checked)
{
...
}
}
|
|
|
|
|
That was it. Why are you using the following instead of a vanilla cast:
RadioButton radio = control as RadioButton Thanks,
Jeff
|
|
|
|
|
Some prefer it that way. I usually use is , but it depends on what you're doing with it, generally (in my opinion) if you find yourself having to cast the same thing multiple times, use as or otherwise perform the cast once, save the value, and use that value.
|
|
|
|
|
Hi Jeff,
protected void btSelect_Click(object sender, EventArgs e)
{
foreach (Control ctl in this.form1.Controls )
{
if (ctl is RadioButton)
{
RadioButton rb1 = (RadioButton)ctl;
if (rb1.Checked == true)
{
lblTest.Text = rb1.Text;
}
}
}
}
Hope will helps
Better to use RadioButton List........
Thanks
"Good Thing Goes With Good People..."
|
|
|
|
|
Hi,
I have .net(2003) soultion file which contains almost 120 Projects(dlls) including commonlib project (which contains common data to rest of projects).
All the projects will have the Project reference to commonlib project.
Whenever i add new project to the solution and rebuild the whole soultion, The finally added project gives out the commonlib dependency error.
When i remove the CommonLib project reference and Again give it back, rebuild it to the finally added project, it is rebuilding fine.
Can you help me out to find, why this is happened?
or any solution to solve this issue?
Thanks
Srini
|
|
|
|
|
I had a similar issue on my references to other projects in my solutions... I used to click on add Reference and use the Browse tab to go to the physical file and make my reference that way.
A better way is to click on add Reference and go to the projects tab. Select the project that you want to reference/depend on. This will make sure that it is built before the new one and references it correctly.
If this isn't what you are doing, then I'm not sure.
Hope this helps!
Hogan
|
|
|
|
|
Hi hogan,
i already made all the references as Project refernce instead dll reference, still im facing this issue.
Thanks
Srini
|
|
|
|
|
I have an application that loads a dataset into a drop down menu in a DataGridView. Separately you can add or remove information from the SQL server that the dataset is populated from.
How do I update the dataset once the program is already running? (Assuming I have added information to the SQL table)
I have played around, and it seems that the dataset may be complied when the app starts, I could be wrong.
Any thoughts are appreciated,
Adam
--Its not broken if it never worked.
|
|
|
|
|
There must be some code that initially loads the dataset. You should figure out where that is. Once you have, you can call this code from somewhere else in your application to reload it.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Yeah.... The DataGridView allows you to select the dataset in the "properties" window, and doesn't allow you access to the code behind it.. at least that I can find.
I've tried all the datagridview.load .update and dataset.load .update combinations that I can think of, but none seem to have an effect. The program doesn't lock up, it just doesn't update the dataset.
--Its not broken if it never worked.
|
|
|
|
|
In this <a href="http://www.codeproject.com/dotnet/DynamicCompileAndRun.asp" rel="nofollow">Article</a>, an example program will compile and run C# code at run-time. My question is: Is it possible to create an EXE from the code at run-time?
My objective is to make a scripting engine that converts a script to C# code and compiles it to an exe.
|
|
|
|
|
|
|
You are welcome
|
|
|
|
|
Anyone know a free tool that can automatically generate classes from an MSSQL database?
Programming is like Mathematics… you take ONE step at the time!
|
|
|
|
|
The new Visual Studio 2008 (currently in beta 2, will be released by the end of this month) has capability built-in.
In the meantime there are plenty of commercial and open source ORMs. MyGeneration[^] is a free open source one.
Also, if you're doing web development, SubSonic[^] has an all-in-one package that includes some good database abstraction.
|
|
|
|
|
Hi. I need to basically have an equivalent C# struct to my C struct. I need to make a pointer to it. This is the relevant code:
C code:
#if defined(WIN32)
# define DLL_EXPORT __declspec(dllexport)
#else
# define DLL_EXPORT /**/
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct vector
{
uint elem_count; /* number of items in the vector */
uint size; /* size of the vector */
uint elem_size; /* element size */
int (*cmp)(const void *, const void *);
void *table;
};
typedef struct vector VECTOR;
#define CSTATS VECTOR
//function definition:
DLL_EXPORT CSTATS *screate(); // returns CSTATS pointer
...
#ifdef __cplusplus
}
#endif
C# code:
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
unsafe public delegate int cmp(IntPtr a, IntPtr b);
[StructLayout(LayoutKind.Sequential, Pack = 1)]
unsafe public struct VECTOR
{
public uint elem_count;
public uint size;
public uint elem_size;
[MarshalAs(UnmanagedType.FunctionPtr)]
public cmp cp; //C-func: public int (*cmp)(const void *, const void *);
public IntPtr table;
}
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
unsafe public delegate VECTOR screate();
[DllImport("myTest.dll", EntryPoint = "screate", ExactSpelling = true)]
public static extern screate scrt();
Now, here is the problem. The C code I want to emulate in C# is this:
CSTATS *st;
st = screate();
In C#, I tried:
VECTOR* st = screate();
VECTOR* st = scrt();
and so on...
The error I get is:
error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('myDll.VECTOR')
So I am looking for help. What is the equivalent C# code that I need, in order to achieve "CSTATS *st; st = screate();" in C?
Thank you for any help.
|
|
|
|
|
Can you repost your code, except this time with <pre> tags around it? It's too hard to read all unformatted like that.
|
|
|
|