|
After looking at docs, this is even better:
<br />
str = str.TrimEnd('\0');<br />
Also, if you are reading a null terminated string, there is a chance you have garbage characters after the terminating null. This will prevent Trim methods from working. So, your best approach would be:
<br />
int Index = str.IndexOf('\0');<br />
if (Index >= 0)<br />
str = str.Substring(0, Index);<br />
|
|
|
|
|
can someone tell me how can i get a DataSet and put it into a RecordSet?
if u know this please help me.
thanks
Nuno Henrique Mendes
|
|
|
|
|
I wrote a windows application using threads. There is some images is in my main form. Form was working well. Then i added a delegate to add controls to main form from another thread. Like this:
using System.Xml;
using System.Threading;
delegate void AddTabPage( string strUniqueID );
namespace ggg
But now, i get a runtime error like this:
An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll
Additional information: Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure "Form_OperatorMain.resources" was correctly embedded or linked into assembly "SupportAliveOperator".
baseName: Form_OperatorMain locationInfo: SupportAliveOperator.Form_OperatorMain resource file name: Form_OperatorMain.resources assembly: SupportAliveOperator, Version=1.0.1238.30259, Culture=neutral, PublicKeyToken=null
can anyone help me?
thanks..
|
|
|
|
|
how can i put an icon in a menu item
thanks
Nuno Henrique Mendes
|
|
|
|
|
You can't do it using standart .Net menu, but you can use this cool library[^].
(Menus with icons, floating dockable panels etc..)
i'm only pointer to myself
|
|
|
|
|
You don't need a special class or library to do it. It's not "that" hard. I just went through the pain of having to figure it out myself. I posted in two questions and though I didn't get the responses I needed, I was able to peice it together and post the answers.
See these two posts over at CodeGuru.
Images in menu
Matching Font and background color
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
How can i make a mainMenu Dockable/Floating?
thanks
Nuno Henrique Mendes
|
|
|
|
|
Ok guys.
Last time james and jonny helped me out. Thanks.
Look at the code outline and tell me how to do it. My main concern is to use a lib that uses pointers as unsafe code. I don't have a clue.. how to go about this... Give some basics about unsafe coding and pointer usage in C#.
This is the error that shows up:
::::The best overloaded method match for 'CsGL.OpenGL.OpenGL.glGenTextures(int, uint*)' has some invalid arguments
The glGenTextures prototype is as follows-
glGenTextures(int,uint*);
Code outline:
.......................................
namespace CORETextureSpace
{
public class CORETexture
{
unsafe public static void CreateTexture(ref uint[] textureArray,string strFileName,int textureID)
{
...............
OpenGL.glGenTextures(1,textureArray);
................
}
}
}
...........................................
namespace GL{
public sealed class myGL5 : Model{
..................
public const uint MAX_TEXTURES = 1;
public static uint[] g_Texture = new uint[MAX_TEXTURES];
....................
public override void Initialize(){
///////////////////////// This line
CORETexture.CreateTexture(ref g_Texture,"bitmap.bmp",0);
}
}
}
"Excellence is never an accident" - JJC
|
|
|
|
|
nosmij wrote:
OpenGL.glGenTextures(1,textureArray);
Should probably be something like:
fixed(uint* tFirstElm = textureArray)
{
OpenGL.glGenTextures(textureArray.Length, tFirstElm);
} The glGenTextures requires a pointer to a uint which it then treats as an array. So you first have to make sure the array doesn't move (a GC can cause memory to move around) via the fixed keyword. Then you can create the pointer to the first element of the array. That is then passed into glGenTextures .
HTH,
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
Anyone know how to make a ActiveX control in C# ?
(visual studio)
Thanks
|
|
|
|
|
|
Hi,
I have two objects, one of type A and one of type B. I want to be able to compare these objects. In my code I want to test for equlity with A.Equals and B.Equals. But I also want to be able to compare A and B type objects with other things. So my code looks like this:
class A
{
override bool Equals(object x)
{
if (x is B)
{
//do something
}
if (x is ...)
{
//do something
}
...
}
}
and the some thing for class B. Is there a better (more elegant) way?
Thanks a lot,
Andrei
andreimatei@home.ro
|
|
|
|
|
Andrei Matei wrote:
Is there a better (more elegant) way?
Not really, but if it gets more complex, have a look at implementing the IComparer interface. This will allow sorting and other goodies too. Also remember Equals(object) does not make if (a == b) true as well. You will need to override the operator for that, or call a.Equals(b).
Cheers
<a TITLE="See my user info" href=http:
|
|
|
|
|
According to the MSDN(Windows media service sdk)
My steps:
1.Install the windows media service in msdn.
2.Run the vbs script to register the interop_msxml and windows media service.
3.Use c# to connect remote window media server9.
The code like as following:
// Declare variables.
Type tServerType;
WMSServer RemoteServer;
IWMSPublishingPoints PubPoints;
IWMSPublishingPoint PubPoint;
IWMSBroadcastPublishingPoint BCPubPoint;
//Create playlist
IXMLDOMDocument playlist;
IXMLDOMNode proc_inst, root, node;
IXMLDOMElement element_smil, element_media;
// Retrieve the type information from the Windows
// Media server running on the remote machine.
tServerType = Type.GetTypeFromProgID("WMSServer.Server",
"192.168.108.1");
// Create an instance of the remote server object locally.
RemoteServer = (WMSServer)Activator.CreateInstance(tServerType);
It work smoothly in my local computer to connect the media server.But while I use this programe in other computer in the same LAN,an error message prompt,(Connection Refuse).With this code,there is no api for setting the user id and password,how the media server identify my computer?
How to create the playlist is the other problem,the code liks as following
playlist = (IXMLDOMDocument)RemoteServer.CreatePlaylist();
proc_inst = playlist.createNode(DOMNodeType.NODE_PROCESSING_INSTRUCTION,"wsx","");
playlist.appendChild(proc_inst);
proc_inst.text ="version=1.0";
playlist.save("cti5.wsx");
It compiles well,but it will prompt a warnning message "No enable data source plug-in is available to access the request content.I don't know what's wrong with this?
I will appreciate your help,pls give me a hand.
|
|
|
|
|
Hello,
Does anyone got idea how to change the highlight of ListView.
Because its default color is dark-blue.
Actaully, I wanna try to modify the highlight display,
e.g. highlight with only a line frame, not a color filled frame.
I can't find any properties for that..
Anyone who expert on this, could you teach me~ ..
Thank you very much
|
|
|
|
|
MS's .NET listview does not support this - it just uses the system highlight color. You might find a listview control here that allows you to do this, or you might want to make your own.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
The ListViewEx class in the SharpLibrary allows this and many other customizations. Here is a screenshot: Screenshot
Regards,
Carlos
|
|
|
|
|
The SharpLibrary looks promising. Great work!
I also liked the icons in your examples. Are they public available?
Øyvind
|
|
|
|
|
|
Hi, Carlos,
Thank you so much..
but could you show me some example how to use ListViewEx class ??
Thanks
|
|
|
|
|
|
Does anyone have any clues as to why I would get an "Unhandled Exception of type 'System.Xml.XmlException'" with the following code sniplet? It just says "Additional information: System Error". What is weird is that the error occurs on the red line and does not throw an exception based on my code (It comes from the IDE). Am I missing something blatant here?
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml("XMLTree.xml");
try
{
<font color="red">XmlNodeList xmlnodeList = xmlDoc.SelectNodes("categories");</font>
foreach(XmlNode x in xmlnodeList)
{
MessageBox.Show(x.InnerText);
}
}
catch(System.Xml.XmlException e)
{
MessageBox.Show(e.Message + "\n\n" + e.StackTrace);
}
-Nick Parker
|
|
|
|
|
your mistake is:
xmlDoc.LoadXml("XMLTree.xml");
you want
xmlDoc.Load("XMLTree.xml");
currently your code thinks that "XMLTre.xml" is xml source
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Philip Fitzsimons wrote:
currently your code thinks that "XMLTre.xml" is xml source
Thanks, that did it.
-Nick Parker
|
|
|
|
|
My guess: it has nothing to do with the categories XPath you gave.
Your xml document is malformed and the parser gets confused in parsing it.
All I need is a roadmap and then I might be able to find a clue.
|
|
|
|