|
Oh, OK. You use the resource manager to load it, using the fully qualified namespace and file name. Do you just want to expose it as a Bitmap property on your class ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am making a control. Should I override functions like OnMouseMove, OnMouseLeave, OnPaint etc or should i create an event handler like this.MouseMove += new blah blah for these
|
|
|
|
|
Depends, really. I tend to override, so I can control when/if the base is called.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
If your creating a control by combining multiple existing controls onto a UserControl form, I would use event handlers. If your creating a completely new custom control by deriving from Control, the best option, and for all intents the only option, is to override the protected members like OnPain, OnResize, OnMouse*, etc.
|
|
|
|
|
i need whole ur help about connecting , inserting, updating ,etc. information to MSAccess,
please give me a whole code sample,
i need a code that could insert to a table.
tnx alot,
ASPERSICA
|
|
|
|
|
Hi there,
First, I think u need to have an overview about ADO.NET technology and then u can try to practise on this
take a look on this link
ADO.NET Overivew
<< >>
|
|
|
|
|
I currently have a method in a class library that is being accessed via .net remoting. The remote object handles active directory functions such as authentication, and getting the groups associated with an authenticated user. My problem is that when I call the method to get the groups for the authenticated user, it fails (something about not being able to find the domain or ldap server), but when i copy that method into my web app and call it directly from the web app, it works fine. Here is the code in the remote object's method:
<code>
public string GetGroups(string strPath, string strFilterAttribute)
{
DirectorySearcher search = new DirectorySearcher(strPath);
search.Filter = "(cn=" + strFilterAttribute + ")";
search.PropertiesToLoad.Add("memberOf");
StringBuilder groupNames = new StringBuilder();
try
{
SearchResult result = search.FindOne();
int propertyCount = result.Properties["memberOf"].Count;
string dn;
int equalsIndex, commaIndex;
for(int propertyCounter = 0; propertyCounter < propertyCount; propertyCounter++)
{
dn = (string)result.Properties["memberOf"][propertyCounter];
equalsIndex = dn.IndexOf("=", 1);
commaIndex = dn.IndexOf(",", 1);
if(-1 == equalsIndex)
{
return null;
}
groupNames.Append(dn.Substring((equalsIndex + 1), (commaIndex - equalsIndex) - 1));
groupNames.Append("|");
}
}
catch(Exception ex)
{
throw new Exception("Error obtaining group names. " + ex.Message);
}
return groupNames.ToString();
}
</code>
I use this to call it remotely (the necessary set up to call the remote object is already taken care of at this point):
<code>string strGroups = myRemote.GetGroups(strPath, strFilterAttribute);</code>
This way causes the error, but when I copy and paste the same method into my web app, I call this way:
<code>string strGroups = GetGroups(strPath, strFilterAttribute);</code>
and it works perfectly. Does anyone have any ideas as to why? Also is there a way to run my web app in debug mode and at the same time run my remote object in debug mode so that I can step into it when it is called? I remember doing this in VB 6 with COM objects (dlls).
Thanks in advance
|
|
|
|
|
Is your class derived from MarshalByRefObject? Or is it serializable?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi Senthil,
Thanks for your response, my class is derived via MarshalByRefObject.
|
|
|
|
|
Hi
please I need help, i need icon in system tray which manages my window service. windows service run on my computer but it doesnt show the icon. and other thing is how i can send messages to window service to do some perticular stuff.
|
|
|
|
|
We'll need some more information before we can help in regards to the notification icon problem (systray icon). Do you already have code to display a system tray icon, or do you need help adding that code?
As for communicating with your windows service, there are many ways, and it all depends on the environment the service is intended to be used in, and what kind of performance you need out of the communication protocol. You can use named pipes (there are several EXCELLENT implementations of named pipe communication here on CodeProject), .NET Remoting (search this site and google for it), as well as custom implementations such as with TCP/IP. Again, more information is needed before useful advice can be given.
|
|
|
|
|
HI Jon Rista,
Thank you for speedy reply.
In my project I need to create communication between .net application and MFC application on the same machine.
Please help me.. after resolving this communcation problem i will handle system tray problem.
Thanks in advance.
Regards,
vidya
|
|
|
|
|
If you want to communicate between dissimilar apps like that (and dissimilar platforms), I would say the best option is TCP/IP if you need to communicate accross a network, or Named Pipes if you just need to communicate to the same machine. There are a couple good named pipe implementations here on CodeProject that should help you get started. You will need to write custom communication code for each app.
|
|
|
|
|
I have an XML formatted string that my program receives from any number of other programs.
It may contain:
<br />
< value="name" type="string" >Aristotle< /value > (Without spaces around value tags)<br />
I need to have a collection which will dynamically create those variables inside itself, but I'm not sure how to do this.
Something like:
public class XMLParser
{
string m_RawXML;
CollectionWithMultipleTypes m_Values = new CollectionWithMultipleTypes() // IS THERE A COLLECTION TYPE BUILT FOR THIS PURPOSE?
public XMLParser(string RawXML)
{
ParseXMLString(string RawXML);
}
public void ParseXMLString(string RawXML)
{
string[] ValueStringsArray = GetValueStrings(string RawXML);
foreach(string valueString in ValueStringsArray)
{
try
{
// Parse string to create new type with name and store data in it
mValues.Add(newVal);
}
catch(Exception err)
{
MessageBox.Show(err.ToString());
}
}
}
}
So, my questions are: Is there a datatype in C# that can store mulitple types of data in it? There aren't built in XML functions for recreating data types from a string, are there? Is this a viable approach? If it is, does anyone have any code that might simplify my life?
As always, Thanks!
-- modified at 15:22 Thursday 3rd November, 2005
|
|
|
|
|
budidharma wrote: So, my questions are: Is there a datatype in C# that can store mulitple types of data in it?
Since all classes are derived from the Object class any collection that can hold objects (e.g. an Array or ArrayList) is capable of holding objects of any class.
For recreating objects from XML I think you'll want to look in to the Reflection classes. You'd need to extract the type attribute from your XML string and use reflection to try and create the object of that class. Maybe it would also be possible to use serialization to recreate your objects?
|
|
|
|
|
Is there a build in XMLRead type command that will retrieve name value pairs from an xml formatted string?
|
|
|
|
|
|
I would check out the XmlTextReader class. Its a very low-profile, rapid, and generally forward-specific class that can blast through huge xml files in short order. Its VERY easy to use, and should solve your problem in a heartbeat. You can likewise use XmlTextWriter to reserialize your collection to similar xml, too.
|
|
|
|
|
|
Basically, you're app has to check out its command line arguments. What is your popup app written in?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
My Popup app is written in C#
|
|
|
|
|
|
I have two release configurations set up in which one has an additional symbol defined so that I can do conditional compilation for each configuration. However, one doesn't need a reference to the 3rd party library, while the other does. When I try to remove the reference in one configuration, it removes the reference in both. Is this possible, or am I doing something wrong?
My articles
BlackDice
|
|
|
|
|
Yes, You have to have the reference in your project. There is no way to remove the reference for just one configuration.
What you can do is, in the properties of the project, select the type of configuration(debug, release, etc what ever you defined) and go to "configuration properties". Then in the configuration in which you need the reference, go to "Build" category add another condition compilation constant eg: "CLASS_LIBRARY"
Modify your code for the using statement.
Only for the reference object do this.
#if CLASS_LIBRARY
using addyourreference;
#endif
This will add your reference conditionally.
|
|
|
|
|
I'm trying something new, but not quite sure how to do it. I have a class for modeling data that contains three types of data - persistant data, data that is semi-persistant, and data that is updated constantly. I would like to have each defined in a struct defined inside my data model class, like so: (This is obviously incorrect syntax, but I can't figure out how do it correctly)
<br />
public class DataModel<br />
{<br />
<br />
private struct PersistantData<br />
{<br />
int m_int1;<br />
int m_int2;<br />
}m_PersistantData;
<br />
private struct SemiPersistantData<br />
{<br />
int m_int3;<br />
int m_int4;<br />
}m_SemiPersistantData;<br />
<br />
private struct DynamicData<br />
{<br />
int m_int5;<br />
int m_int6;<br />
}<br />
<br />
public UpdatePersistantData(int int1, int int2)<br />
{<br />
m_PersistantData.m_int1 = int1;<br />
m_PersistantData.m_int2 = int2;<br />
}<br />
<br />
...<br />
}<br />
Obviously, thats not the actual program, but it shows how I would like to declare and use the structs. Is this possible?
|
|
|
|