|
I can't find it. I have:
this.styleStages.GridColumnStyles["ColumnName"]
ColumnName has allignment property, but that will allign the data inside the cells, and not the header. Am I looking in the wrong place?
Thank you
|
|
|
|
|
Humm, that's interesting. I guess setting the alignment after adding a TableStyle then only sets alignment of the data.
Anyway, when I tested on my datagrid I did the testing during the creation of the TableStyle.
Example:
<br />
private void CreateGrid()<br />
{<br />
DataGridTableStyle ts = new DataGridTableStyle();<br />
ts.MappingName = "TableName";<br />
<br />
DataGridTextBoxColumn textCol = new DataGridTextBoxColumn();<br />
textCol.MappingName = "ColumnName";<br />
textCol.HeaderText = "Test Column";<br />
textCol.Alignment = HorizontalAlignment.Center; <<-- Set alignment here<br />
ts.GridColumnStyles.Add(textCol);<br />
<br />
myGrid.TableStyles.Add(ts);<br />
}<br />
|
|
|
|
|
I've got a set of xml files which all look similar to this one:
<?xml version="1.0" encoding="utf-8" ?>
<designs>
<item>
<title>Standard</title>
<description>Das Standard Layout.</description>
<stylesheetname>default.css</stylesheetname>
<imageurl>standard.jpg</imageurl>
</item>
<item>
<title>Text Version</title>
<description>Das Leichtgewicht.</description>
<stylesheetname>textonly.css</stylesheetname>
<imageurl>textonly.jpg</imageurl>
</item>
</designs>
The number of item elements varies. What is the easiest way to loop through the xml and extract the individual data items? I had a look at the XmlTextReader but the methods provided in this class seem a bit cumbersum. There must be an easier way...
Any help is greatly appreciated.
/matthias
|
|
|
|
|
Try using XPath
XmlDocument document = new XmlDocument();
document.Load(filename);
XmlNodeList nodes = document.SelectNodes("designs/item");
foreach(XmlNode node in nodes)
{
...
}
something like that should go through the nodes...
|
|
|
|
|
Here is a simple process the goes through an entire XML file regardless of definition.
XmlTextReader reader = new XmlTextReader(@"..\..\test.xml");
try
{
while (!reader.EOF && reader.NodeType != System.Xml.XmlNodeType.Element)
{
BuildLine( reader, reader.NodeType.ToString(), reader.Name, reader.Value );
reader.Read();
}
if (reader.EOF)
{
reader.Close();
results.Items.Add("End of file process");
return;
}
}
catch (System.Exception exc)
{
results.Items.Add(exc.Message);
if (exc.InnerException != null)
results.Items.Add(exc.InnerException.Message);
return;
}
int currentDepth = reader.Depth;
DoAttributes(reader);
do
{
if (reader.NodeType == System.Xml.XmlNodeType.Element)
{
results.Items.Add(BuildLine( reader, "Element", reader.Name, reader.Value ));
if (reader.AttributeCount > 0)
{
DoAttributes(reader);
}
reader.Read();
}
else
{
results.Items.Add(BuildLine( reader, reader.NodeType.ToString(), reader.Name, reader.Value ));
reader.Read();
}
} while (!reader.EOF
&& !((reader.NodeType == System.Xml.XmlNodeType.EndElement
|| reader.NodeType == System.Xml.XmlNodeType.Element)
&& reader.Depth <= currentDepth));
...
private void DoAttributes(XmlTextReader reader)
{
results.Items.Add(BuildLine( reader, reader.NodeType.ToString(), reader.Name, reader.Value ));
if (reader.MoveToFirstAttribute())
{
do
{
results.Items.Add(BuildLine( reader, "Attribute", reader.Name, reader.Value ));
}while(reader.MoveToNextAttribute());
}
}
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Both the suggestions submitted are good.
If you want a good tutorial on working with XML try Here and look for Lesson 10: Working with XML
(NB: The Tutorial is for Visual C# 2005 Express)
|
|
|
|
|
need a way to connect flash with C# program or photoshop
|
|
|
|
|
|
Where is this usually goes within your class? Do I place it before all of my methods< and it will affect all of them?
Thank you
|
|
|
|
|
|
Hi all,
My program is using MS WORD in automation (unvisible). Sometimes, in a case of failure WORD stays active in memory. I think I will find a solution in this forum to kill WORD in the tasklist (I have seen somethink here) but how can I prevent to kill a version wich I have not created by my program.
(I already hear the cusomer crying - where is my text)
Who can solve my problem
Thanks alot
Frank
|
|
|
|
|
This should do it
private int _WordAppProcessID= 0;
[DllImport("user32.dll", EntryPoint="GetWindowThreadProcessId")]
public static extern uint GetWindowThreadProcessId(int Hwnd, ref int ProcessID);
GetWindowThreadProcessId(this._WordApp.Hwnd, ref this._WordAppProcessID);
KillExcelInstance();
internal bool KillExcelInstance()
{
// Kill our instance of Excel...
if (this._ImportExcelProcessID != 0)
{
Process.GetProcessById(this._WordAppProcessID).Kill();
return true;
}
return false;
}
Live Life King Size
Alomgir Miah
|
|
|
|
|
Thank you,
it seems to be the right way...
but I have the problem that _wordAPP derieved from Word.ApplicationClass() has no Hwnd. Do you know
where to get it ?
Thanks
Frank
|
|
|
|
|
Hi
How can i create an exe file written in C# which is not depends on the .Net Framework?
I want to run this program without any installation - a standalone exe.
I think that i'll get this goal using windows API programming but i'm not sure and i didn't find any good reference that teach me how to do this.
Am i right? do you have any idea how can i start doing it?
Thanks a lot
Mamtz
|
|
|
|
|
You can't. If you need a standalone executable you need to work in c++.
|
|
|
|
|
mamtz wrote:
How can i create an exe file written in C# which is not depends on the .Net Framework?
You can't. Period. End of story.
mamtz wrote:
I think that i'll get this goal using windows API programming
Not a chance. The .NET Framework comiles you code into machine code when it's executed, not when you compile it. When you compile your app, it's converted to processor-independant MSIL (MS Intermiediate Language) code. It's not actually runnable by any processor.
Also, the .NET Framework is required for compiling to processor specific code, memory management, object allocation and destruction, garbage collection, ..., the list oges on and on, ... and on some more, ... Just making calls into the Win32 API definately does not release you from requiring the .NET Framework.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
Just making calls into the Win32 API definately
Isn't the correct spelling definitely? A lot of people over here seem to use your spelling, I'm wondering which one is right.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Yeah, it's "definitely". I can type, not neccessarily accurately, faster than I can spell. I seem to make that same mistake alot, kind of like typing "hte" for "the".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
An alternative that is available but not supported by Microsoft would be to use a .NET linker. Here are a couple...
Remotesoft Salamander[^]
Thinstall[^]
I have only played with the demo versions of these, but I have heard decent things about both (except for price).
Steve Maier, MCSD MCAD
|
|
|
|
|
Using the .NET Linker has it's advantages, but it also has a rather large downfall. If you try to install one of the .NET Framework service packs, it'll fail.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
To make a media player ,i need the "Interop.QuartzTypeLib.dll",
How can i get it?from where? for free? THANK YOU
yinhuiZhou
|
|
|
|
|
|
you can get it under C:\windows\System32.Include it in your porject as a reference and use the methods.there are lot of help you can get on internet.Just search with QuartzType.dll
|
|
|
|
|
Dear All,
I am developing a DLL to allow other program to import as a reference (something like creating an API). As we know, when other program declares a reference to my DLL, and starts using it, after typing the object name followed by a dot ("."), a list of properties and methods available from the DLL will appear. What I want to ask is, is it possible for me to add Intellisense features to my DLL, providing a quick info to the properties and methods that I have in the DLL, to the clients of my DLL? I have heard that this can only be achieved if I develop the DLL using C#, not VB.NET, is that true?
Thanks alot for ur help
|
|
|
|
|
ysuwardy wrote:
I have heard that this can only be achieved if I develop the DLL using C#, not VB.NET, is that true?
No, that's not true.
There are two things that you have to do. First you have to add documentation to your code, then you have to make Visual Studio create an xml documentation file from the comments.
In C# you use /// to create xml comments, in VB you use '''. Just type it on the line before the method, and Visual Studio gives you the start automatically.
I have described how to make Visual Studio create the xml documentation file before, in some of these boards. Search for it.
---
b { font-weight: normal; }
|
|
|
|