|
nissiml,
Have a look at http://www.codeproject.com/csharp/fswatcher.asp[^] it will monitor a selected directory for changes. It may be eaiser to just proactivly back-up and monitor the files rather than try to intercept the file deletion.
Hope this helps
quorum pars magna fui
|
|
|
|
|
Hi guys
I am wkg on a C# Component which retrieves information from the ADS on Win2k Domain. For some reason, instead of using the System.DirectoryServices namespace, I have to go for the ADS Library (a COM DLL).
To write the code in VB.NET I can go ahead and use the GetObject Global method of VB. as following...
<br />
Dim objLDAP as ActiveDS.IAdsOpenDSObject<br />
objLDAP = GetObject("LDAP:")
' Here it uses the Global GetObject method,
' that specifies the First param as path and...
' NO ProgID as it is Optional Param.
In C#, I cannot use the same global function, hence the alternative, Activator.GetObject can be used. But it does not retrieve the reference at all.
I even tried, Specifically giving the Type param to the Method as...
<br />
IAdsOpenDSObject objLDAP;<br />
objLDAP = Activator.GetObject(typeof(ActiveDS.IAdsOpenDSObject), "LDAP:");
This ends up in giving error message saying that,
A Proper link to the Service may not have been established correctly. How can I make this work, as I must have all my Components in C# only. Porting this part in VB.NEt only for this reason would be infeasible.
Please help me out in this.
Atul Kale
Sr. Software Engineer.
XcelVision Technologies Ltd.
|
|
|
|
|
You really should be using System.DirectoryServices for this, and only resorting to the ADSI library as a last resort.
The Activator.GetObject is not related to the VB GetObject function. To replace the VB functionality, you can either use the Microsoft.VisualBasic.Interaction.GetObject function, or use a combination of the BindToMoniker and GetActiveObject functions from the System.Runtime.InteropServices.Marshal class.
using System;
using System.Runtime.InteropServices;
public class ComUtils
{
public static object GetObjectFromClass(string className)
{
object ret = Marshal.GetActiveObject(className);
if (null == ret)
{
Type t = Type.GetTypeFromProgID(className);
ret = Activator.CreateInstance(t);
}
return ret;
}
public static object GetObject(string pathName)
{
return Marshal.BindToMoniker(pathName);
}
public static object GetObject(string pathName, string className)
{
if (null == pathName || 0 == pathName.Length)
{
return GetObjectFromClass(className);
}
else if (null == className || 0 == className.Length)
{
return Marshal.BindToMoniker(pathName);
}
else
{
object ret = GetObjectFromClass(className);
UCOMIPersistFile pf = (UCOMIPersistFile)ret;
pf.Load(pathName, 0);
return pf;
}
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hi Richard,
Thanx a lot for that code! In fact I had tried all the possible combinations of using Type.GetTypeFromProgID and then calling the Activator.GetObject etc. etc. But the most important thing I forgot was about the Binding part. I had been wkg on VC++ with Monikers many a times, I just never thought I would need them here too.
regards
Atul Kale
MCSD, MCT
Sr. Software Engineer
XcelVision Technologies Ltd.
|
|
|
|
|
does anyone know how to create disk quotas for users in c#, i am having a pain trying to figure this out.
please help!

|
|
|
|
|
Hi,
I'm new to this "Crystal Reports Stuff"... I would like to know a bit more about this...
Does it come to use it for free with VStudio .net ? ( at least for desktop applications ?).
How easy and powerful is this tool ? It's easy to integrate that into my applications ?
I'm thinking about start studying about this, or just export my reports into Ms Word, is that a good idea ?
thanks a lot, greetings
Braulio
|
|
|
|
|
I want to save My drawings on a form to a jpg of Gif files??!
I did it..but when I try to open them in a paintbrush or IE..I got some problems..on IE it didn't appear
and on paint brush it opens a black image??
please I need help in this as soon as possible
thanks
Muhammad Mahmoud Mousa Soliman
Faculty of Computers & Information Sciences
Information Systems Major
Ain Shams University in Cairo
|
|
|
|
|
Look You Stupid Guy
Try The Following And It Will Work
Image MyImage = Bitmap.FromHbitmap(ControlPaint.CreateHBitmap16Bit(MyBitmap, Color.White));
MyImage.Save("MyImage.gif", ImageFormat.Gif);
Your Master
Ahmed Mostafa Ahmed Aboelkhair
P.S. I Am His Freind And I Am Kidding With Him
|
|
|
|
|
Hi, all:
I am totally stuck, please help. I have a datagrid on the WinForm ( using C# ). I am trying to create a combobox for one of the columns. I use the technique described in MS KB Article 323167 ( coded in VB.NET) and I port the code to C#. It works fine for the existing rows. Whe I click on the * row ( i.e., try to create a new row) on the datagrid. The combobox seems there, but when I click on the down arrow, the combobox does not dropdown. Occasionally, I can get the dropdown, but when I leave the cell, the changed value goes to the previous row ( strange!). The primary key is AutoNumber, when I click on the new row ( with "*" in front of it), I sometime get little pencil in front of the row, but sometimes I do not get it except the autonumber ( almost like it does not treat as a new row ).
Has anyone use this combobox technique and work on the new row successfully? I include the code snippet ( handling the events) here, if you can spot anything I did wrong, please let me know.
Any help is highly appreciated. Thanks in advance.
Dion
************ Code Starts here ***********
private void dataGrid1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
if ( dataGrid1.CurrentCell.ColumnNumber == 1 )<br />
{<br />
cbType.Width = dataGrid1.GetCurrentCellBounds().Width;<br />
}<br />
}<br />
<br />
private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)<br />
{<br />
if ( dataGrid1.CurrentCell.ColumnNumber == 1 )<br />
{<br />
cbType.Visible = false;<br />
cbType.Width = 0;<br />
cbType.Left = dataGrid1.GetCurrentCellBounds().Left;<br />
cbType.Top = dataGrid1.GetCurrentCellBounds().Top;<br />
cbType.Text = dataGrid1[dataGrid1.CurrentCell].ToString() + "";<br />
cbType.Visible = true;<br />
}<br />
else<br />
{<br />
cbType.Visible = false;<br />
cbType.Width = 0;<br />
} <br />
}<br />
<br />
private void dataGrid1_Scroll(object sender, System.EventArgs e)<br />
{<br />
cbType.Visible = false;<br />
cbType.Width = 0;<br />
}<br />
<br />
<br />
private void dataGrid1_Click(object sender, System.EventArgs e)<br />
{<br />
cbType.Visible = false;<br />
cbType.Width = 0;<br />
}<br />
<br />
<br />
private void cbType_TextChanged(object sender, System.EventArgs e)<br />
{<br />
if ( dataGrid1.CurrentCell.ColumnNumber == 1 )<br />
{<br />
cbType.Visible = false;<br />
<br />
if ( ( dataGrid1[dataGrid1.CurrentCell] + "") == "" )<br />
{<br />
SendKeys.Send("*");<br />
}<br />
<br />
dataGrid1[dataGrid1.CurrentCell] = cbType.Text;<br />
} <br />
}
|
|
|
|
|
Hi,
What do i need to develop win ce apps with .net??
is there some sdk for it? , is it even possible?
//Roger
|
|
|
|
|
The compact framework (subset of the .NET SDK). Available as part of .NET 1.1 (still in beta[^]).
|
|
|
|
|
excuse my ignorance now but , when that is installed , can i compile apps in vs.net to the 1.1 framework? do i need to point vs.net to where the new compiler is or?
i have no idea what im doing now ... totally confused
//Roger
|
|
|
|
|
Whatever VS.NET version, the .NET (standard or compact) version the compiler compiles and runs against is HARDCODED. So you must have the adequate environment :
If you are using VS.NET 2002, then you can separately download the compact framework. I don't have the link, but you probably can get it somewhere from the MS site (even though MS tends to push their 1.1 beta).
If you are using VS.NET 2003 beta, then you can download the 1.1 .NET framework (either run-time or SDK). What you download has both the standard and compact versions to play with.
|
|
|
|
|
Is it possible to call a COM component in C# from a COM in MFC with in WinCE
|
|
|
|
|
|
The only way I know of to develop CE apps in C# is using the VS.Net 2003 Beta, which includes a CE.Net emulator for testing of CE apps right on your development machine. Go to MSDN and look at the MSDN Show - they had an epsiode a couple of months back focussing on developing with the compact framework.
Although MS have publicly released the framework 1.1 beta (which contains the compact framework - aka CE.Net) AFAIK there is absolutely no way to use it with VS.Net 2002. If someone can would like to correct me on this, I would be glad to hear it.
|
|
|
|
|
Hi every:
How can i use C# to call VC dll???
it's include a parameter type ---> Char
when i call this dll in C#
it's return value is error...
please help me~~~~~~~~
exam:
declare:
[DllImport("test.dll")]
public static extern int teststring([In,Out] string aa)
and call:
string aa=”HI! Nice to Meet You!”;
RetString = teststring(aa);
----------------------------------
becase in VC the dll's parameter is declare a Ascii Array
how i can do to trun vc's parameter(ascii array) to become
a string in C#.....
|
|
|
|
|
try
<br />
[DllImport("test.dll", CharSet=CharSet.Ansi)]<br />
public static extern int teststring(string aa);<br />
If it doesn't work, don't hesitate to post the actual C/C++ function prototype.
|
|
|
|
|
I did a few columns on this last fall. I'd suggest this one:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp09192002.asp
|
|
|
|
|
I'm just starting out with C# and I'm following one of the Microsoft walkthroughs for creating a distributed application.
It involves IIS, SQL server and a windows client and a web client.
The windows client works fine, but the web client just times out so I was poking around trying to find out what's going on because there are no obvious problems (aka I don't know really what to look for ).
Anyway, the question I have is when I switch to HTML view for my web form, the first line of xml code is highlighted in yellow, the line is (not broken in the original, just one line):
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>
Is this to indicate an error or parsing problem of some kind or....?
The full code for the form is this:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %><br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><br />
<HTML><br />
<HEAD><br />
<title>WebForm1</title><br />
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0"><br />
<meta name="CODE_LANGUAGE" Content="C#"><br />
<meta name="vs_defaultClientScript" content="JavaScript"><br />
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"><br />
</HEAD><br />
<body MS_POSITIONING="GridLayout"><br />
<form id="Form1" method="post" runat="server"><br />
</form><br />
</body><br />
</HTML>
|
|
|
|
|
It's 100% normal for it to be highlighted yellow. The yellow highlighted lines in asp.net pages are lines that specify the backend library for the page.
|
|
|
|
|
Thank you Furty. That rules that out as pointing to the problem.
I guess I'm going to have to do some digging to figure out how to debug a web application.
Thanks again
|
|
|
|
|
Hi there,
I just thought this information might be useful to u! Though from ur mail it sounded like u r just beginning ASP.NET, I would not try and offend u by giving some information that u already know! If it helps, GREAT!
Debugging a web Application fortunately is much better in VS.NET than it was in InterDEV with ASP.
A process named ASPNET_WP.exe runs on the machine within which your ASP.NET (C# or VB.NET) code is debuged.
If your solution contains several projects, just set up any of the desired projects as a Startup Project from the Context menu, and any of the aspx pages as the startup page.
If your machine's config is very good, you will go for this traditional debugging approach which is good too!
But, there is a better approach wherein, you just open any desired page in the Browser, and at any point of time Go into Debug mode by Attaching to the ASPNET_WP.exe process from Tools->Debug Processes menu option. just go ahead with the default options while doing this.
Hope htis helps a bit!
Atul kale
Sr. Software Engineer
XcelVision Technologies Ltd.
|
|
|
|
|
Hi Atul, that information is extremely helpful, thank you very much!
Cheers!
|
|
|
|
|