|
|
Use the combo boxes SelectedIndexChanged event.
private void mycombobox_SelectedIndexChanged(object sender, System.EventARgs e)<br />
{<br />
\\Code Here<br />
}
|
|
|
|
|
I am having a problem with this method:
private void UniversalRegEx(string szMyRegEx, string szWhatFor)
{
//The universal RegEx
//Set it (Query, What it will put as a heading)
Regex rxFind = new Regex((szMyRegEx), RegexOptions.IgnoreCase);
MatchCollection matches = rxFind.Matches(szTibiaProfile);
foreach(Match m in matches)
{
string szTemp = szWhatFor + ": {0}", m.Groups["mmatch"];
WriteLookup(szTemp);
}
return;
}
See the problem? It says this is wrong:
string szTemp = szWhatFor + ": {0}", m.Groups["mmatch"];
Thanks for the help.
Example of passed data:
//Get Character Name
UniversalRegEx(">Name <mmatch>[a-z]+)", "Name");
|
|
|
|
|
replace this line
string szTemp = szWhatFor + ": {0}", m.Groups["mmatch"];
with
string szTemp = szWhatFor + ": "+ m.Groups["mmatch"];
|
|
|
|
|
That works now, thanks. But what did I do wrong with the way I set it up? In my console app that works.
|
|
|
|
|
In your console app, this is a valid function call:
Console.WriteLine("Here is my string: {0}", myString);
but without this function:
"Here is my string: {0}", myString; //this is not valid syntax.
If you want to define a string like this, use the String.Format function.
String.Format("Here is my string: {0}", myString); //this is valid
Otherwise, use proper syntax:
"Here is my string: " + myString; //this is valid syntax.
|
|
|
|
|
Oh, thanks alot. Wasn't sure if it was a reference I needed or what. Thanks alot man.
|
|
|
|
|
Hi,
I need to display some DirectDraw surface (.dds) files in my application (Not my choice, that's the stuff I've been given). Is this possible without using DirectX? If not, can I somehow use DirectX to load the dds into a PictureBox?
Thanks.
|
|
|
|
|
You can initialize DirectX to draw into any control you want.
If you are looking for a quick way to do some DX you should look at this: http://www.3dlevel.com/gamedev/news.php
this is a game engine build with VB.NET and uses managed DX. Very simple, takes only a few lines to show a sprite or whatever...
So if you don't want to learn all the DX stuff this is defenitly the way to go.
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hello i have a toolbar in my application and i have visual styles enabled. when i enabled visual styles it wont show the icons in my toolbar otherwise it when visual styles arent enabled it shows the icons. Is there a way to have visual styles enabled and to show my toolbar icons
Thanks
|
|
|
|
|
This is caused by a bug in the .NET framework. You can work around it by calling Application.DoEvents() after enabling visual styles like this...
static void Main()
{
Application.EnableVisualStyles();
<code>Application.DoEvents();</code>
Application.Run(new MyForm());
}
-- modified at 23:35 Tuesday 14th February, 2006
|
|
|
|
|
I am working on a scanning project. The scanners I am working with do not support TWAIN job control. We are wanting to fake job control by using solid black pages as our job control pages. The TWAIN software I am using gives me a DIB per page that is scanned. I want to inspect the DIB during scanning and start a new image when I find a solid black image. I have look around but can't find anything that does this. I was wondering if anybody had a suggestion. Please let me know.
Thanks,
Dave
|
|
|
|
|
Hi,
I've built an xml schema hierarchy where, for instance, {path, file} is a schema type and subsequently {params_1, params_2, ...} each import a {path, file} type. I include code below.
My question is this: How to resolve use of namespaces and hierarchical schema design with C# xml consumption.
From C# I do this:
reader = new XmlTextReader(config_filename);
xmldoc = new XmlDocument();
xmldoc.Load(reader);
Then this:
XmlNode n = doc.SelectSingleNode( "session/gateway/file" )
This instruction returns 'null'. I believe its because the xml doc reads <ns1:file> rather than <file>. However, I want <ns1:file> (or whatever namespace) because I want to have reusable schema patterns.
(Note doc.SelectSingleNode( "session/gateway" ) and ...( "session" ) do work.)
The reason I'm doing SelectSingleNode( x ) is to populate a HashTable with specific values possibly available in the xml.
Finally, here's a snippet of my xml doc. Thanks in advance.
<?xml version="1.0" encoding="UTF-8"?>
<session xmlns:ns1="foo" xmlns:ns2="bar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="baz.xsd">
<gateway>
<ns1:path>(/ns1:path>
<ns1:file>"gateway.xml"</ns1:file>
</gateway>
<strats>
<ns1:path></ns1:path>
<ns1:file>"strats.xml"</ns1:file>
</strats>
<log>
<ns1:path></ns1:path>
<ns1:file>"session.log"</ns1:file>
</log>
</session>
-- modified at 7:17 Wednesday 15th February, 2006
|
|
|
|
|
You need to use a XmlNamespaceManager .
string xml =
@"<?xml version=""1.0"" encoding=""UTF-8""?>
<session xmlns:ns1=""foo"" xmlns:ns2=""bar"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:noNamespaceSchemaLocation=""baz.xsd"">
<gateway>
<ns1:path></ns1:path>
<ns1:file>""gateway.xml""</ns1:file>
</gateway>
<strats>
<ns1:path></ns1:path>
<ns1:file>""strats.xml""</ns1:file>
</strats>
<log>
<ns1:path></ns1:path>
<ns1:file>""session.log""</ns1:file>
</log>
</session>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
XmlNamespaceManager nm = new XmlNamespaceManager(doc.NameTable);
nm.AddNamespace("ns1", "foo");
XmlNode node = doc.SelectSingleNode("session/gateway/ns1:file", nm);
if(node != null)
Console.WriteLine(node.OuterXml);
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
So this means my C# code guts must know the namespace and namespace aliases used in the xml schema? You write
nm.AddNamespace("ns1", "foo");
Isn't this fragile to schema changes?
Does XmlSchema allow for importing my schema, against which the xml doc was created, so that the namespace and namespace aliases are imported?
-- modified at 8:46 Wednesday 15th February, 2006
|
|
|
|
|
Your C# code must know the namespaces. The namespace prefixes are immaterial. The code that I submitted to you would work just as well if I made the following changes.
nm.AddNamespace("goobledygoobledygook", "foo");
XmlNode node = doc.SelectSingleNode("session/gateway/goobledygoobledygook:file", nm);
if(node != null)
Console.WriteLine(node.OuterXml); The prefixes are aliases, as you point out. However, to get to a node that belongs in another namespace, you will have to know to which namespace that node belongs. The file node, for example, lives in another namespace. Because of that, your C# code (and you!) will have to handle that.
If you don't want to deal with the namespaces, use a regular expression to remove all prefixes from the string representation (i.e., XML source) and put that into an XmlDocument .
|
|
|
|
|
Curtis, thank you for your time on this. Perhaps you can respond to the larger question. I have XMLSpy and it is natural (to me) to build reusable schemas which I 'type' (including a namespace) and then import into a larger schema. Then I build xml doc's against this schema.
On the C# side ideally I'd just like to traverse the node tree. So I've learned that either I keep a namespace table to read the hierarchical xml docs, or I flatten the schemas into 1 level, or I use your suggestion of cleaning the doc using regex.
What do you consider 'best practices' here?
Thank you.
|
|
|
|
|
That's a tough one. If you use XPath, then you'll have to perform one of the three. In that case, I would recommend using the method that would present the simplest solution to you. The three, in practice, have a common outcome; thus, you should choose the one with which you feel most comfortable.
I hope that input helps.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
hi
how can i get or make an Icon for execute(exe) file in my project?
thanks !
s_mostafa_h
|
|
|
|
|
Add the icon to your exe project. Select the icon file in your tree view and show its properties. For the "Content Type" property select "Embedded Resource". Now, select your exe project in the tree view and show properties. Under the General tab there is an "Application Icon" property. Set this property to the file name of your icon.
I hope this helps.
Deus caritas est
|
|
|
|
|
When I try this it says that my ico file is bad, what are the properties that it requires the icon to be? I read it was picky, but the book had no data on it.
|
|
|
|
|
Try a 16x16 icon with 256 colors. That is what I am using. I suppose a 24-bit color icon would work too but I think it has to be 16x16.
Deus caritas est
|
|
|
|
|
THANKS FOR YOUR Reply !
s_mostafa_h
|
|
|
|
|
How can you extract the metadata or summary or tags of a PDF file in c#.
For example: Author, Title, etc.
-- modified at 16:42 Tuesday 14th February, 2006
|
|
|
|
|
Is there a way in C# using win32 to arrange the child windows of ReBarWindow32 (IE) like ComboBoxEx32, ToolbarWindow32 etc in same line. My purpose is to programmatically set a single line for the explorer toolbar section so that menu, tools and addressbar should be horizontally aligned.
Any help in this regard would be highly appreciated ..
thanks
Sree..
|
|
|
|