|
You've allocated the array for your GrassType objects, but didn't instantiate the array elements.
Add
Grass[x,y,i] = new Grass();
after
MeshRandom = (float)random.NextDouble();
and you should be fine.
mav
|
|
|
|
|
Fi all.
I need to write application that can over view ziped files
and for each one of them, show what's in it.
can someone give me some leads???
10x
Assaf
|
|
|
|
|
|
Hi,everyone.
Recently,I transform a XML document using a xsl document in a project.I use
"document('')" to replace self.when I program by c#,I find it couldn't work .The XPATH word about "document('')" isn't explain,the c# word is
xslt.Transform(nav, null, s, null);
This is my xml
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="viewer.xsl" ?>
<resultset>
<result>
<custname>Tom</custname>
<sex>2</sex>
<addr2>dfd</addr2>
<addr1>dff</addr1>
<customerid>145f3444-302f-407b-b6d5-c8aeaee9b253</customerid>
</result>
<result>
<custname>John</custname>
<sex>2</sex>
<addr2>ddd</addr2>
<addr1>sss</addr1>
<customerid>9099cc4d-ef82-47e6-ab3b-7b2c7d091a55</customerid>
</result>
</resultset>
This is my xsl ,it is in Cache
<?xml version="1.0" encoding="utf-8" ?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:map="maps.uri">
<xsl:template match="/resultset"><resultset><xsl:apply-templates />
</resultset>
</xsl:template><xsl:template match="result"><result><xsl:for-each select="*">
<xsl:variable name='atrname' select='name()'/><xsl:variable name='atrvalue' select='text()'/>
<
<xsl:value-of select='$atrname'/>
<xsl:if test="document('')/xsl:transform/map:stringmap[AttributeName=$atrname and AttributeValue=$atrvalue]/value!=''">
name="<xsl:value-of select="document('')/xsl:transform/map:stringmap[AttributeName=$atrname and AttributeValue=$atrvalue]/value" />"
</xsl:if>
>
<xsl:value-of select='$atrvalue'/>
</
<xsl:value-of select='$atrname'/>
>
</xsl:for-each>
</result>
</xsl:template>
<map:stringmap>
<AttributeName>sex</AttributeName>
<AttributeValue>1</AttributeValue>
<value>M</value>
</map:stringmap>
<map:stringmap>
<AttributeName>sex</AttributeName>
<AttributeValue>2</AttributeValue>
<value>F</value>
</map:stringmap>
</xsl:transform>
I want get the 'value''s value from the xsl if it can meet my need;It word well in IE.
What can I do ?
|
|
|
|
|
|
Hello, I am trying to open a word or excel document in browser. However, each time it asks open,save,cancel with a dialog box. I want to only open the file. Is there any way to do this operation? I tried the code indicated below,but it opens always a dialog box with open,save,cancel buttons. I would be glad if someone help me.
Thanks.
Response.ClearContent();
Response.ClearHeaders();
Response.Clear();
Response.ContentType = "application/x-msexcel";
Response.Charset = "";
Response.AddHeader("Content-Disposition", "inline; filename=" + dokname); Response.AddHeader("Content-Length",fileLength);
Response.WriteFile(fileUrl);
Response.Flush();
Response.Close();
Fatih Sen
|
|
|
|
|
Dear All,
In .Net, DataGrid allow mutiselect items is default.
I want a single select DataGrid. Can you help me?
Thanks!
quangthien
|
|
|
|
|
Hi!
Set the property RowHeaderVisible of the datagrid to false.
HTH
|
|
|
|
|
Beginners question.
How do I pass listbox control to a class method and obtain access to the .items collection?
Can you point me to some sample code?
Thanks.
|
|
|
|
|
You would pass a reference to the control the same way you'd pass any variable to a method as a parameter:
void ClearList(ListBox listBox)
{
listBox.Items.Clear();
}
void Example()
{
ListBox listBox = new ListBox();
ClearList(listBox);
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi, i was trying to retrieve information about the status of the battery, and to access the properties i tried to create an instance like the following:
PowerStatus bat = new PowerStatus();
But the error that i receive is that the class PowerStatus doesn't have a constructor defined and when i checked the class it doesn't have the constructor like other classes, you know the one called "PowerStatus()",so i´m wondering: am i doing something wrong?? or is a problem of the .NET Framework 1.1 ??cause i tried different ways to declare the same thing
I appreciate your help
|
|
|
|
|
|
As Christian said, if it doesn't declare a public default constructor you can't instantiate it using the void parameter list. The PowerStatus class in .NET 2.0 does declare any public constructor, actually, meaning that you can't instantiate it.
According to the documentation, you can obtain a reference to it using the static SystemInformation.PowerStatus property:
PowerStatus status = SystemInformation.PowerStatus;
Console.WriteLine("Battery life remaining: {0}",
status.BatteryLifePercent == 255f ? "Unknown" : status.BatteryLifePercent);
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I'm building an app in C#. It's a Windows App and it needs this common functionality ( we probably get to see in many windows apps ) where the user can keep on pressing the "Next" button when he finished entering a certain amount of data to go to the next level / display different controls.
The situation Im trying to explain is similar to a Setup program that executes an installation, while you keep on pressing the "Next" button.
So how can i achieve this in C# ? I know that in Java there are several Layout Managers like Card Layout to handle this type of situations. The only way possible I think is to add all the controls to be displayed in each step to a collection of Panels and then toggle their visibilty as needed.
But isnt there any easier way like in Java to get the job done ?
Thanx in advance !
|
|
|
|
|
If you want to show a whole lot of different screens, then I don't see a simpler way of doing it than creating panels as seperate user controls, then adding them all to your form. I'd put the page names into an array, the pages into a hash table by name, and add methods for go forward and backwards that look up the right panel to make visible, if you call an internal method that's a lot easier than trying to hide all panels but one in a lot of different places.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
www.codeproject.com/cs/miscctrl/magicwizard.asp
The Magic tool kit has a fairly easy to use wizard you might want to look at....
|
|
|
|
|
You should post this as a response to the original poster, so he gets an email notification of it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
www.codeproject.com/cs/miscctrl/magicwizard.asp
The Magic tool kit has a fairly easy to use wizard you might want to look at....
|
|
|
|
|
Thank you very much guys !
I looked up the Magic Wizard code project. I think thats more inline with my requirement. I actually do not hav the time to go thru it now, but when i get back home Ill take a look at it and say how well it suits my purpose, as well as .NET's work around for such a situation.
And also, it jus struck me that my original solution ( the panel collection ) is not that feasible, cos it would take up some memory overhead wudn't it ?
Thanx again guys , sorry for this late and hasty response.
|
|
|
|
|
Can someone please help me with creating a loop to read from an Xml file into a jagged array.
The Xml file looks like this:
<test>
<problem type = "multichoice" elnumber = 8>
<question ID = 1>This is the question text</question>
<answer1>this is answer A</answer1>
<answer2>this is answer B</answer2>
<answer3>this is answer C</answer3>
<correct>answer2</correct>
<explanation>this is why</explanation>
</problem>
<problem type = "dragndrop" elnumber = 4>
<question ID = 2>This is the question text</question>
<explanation>this is why</explanation>
</problem>
Im using a jagged array because each question will have a different number of elements as shown above.
Can anyone suggest a good way to tackle this? An example code or structure would be appreciated. Thanks.
|
|
|
|
|
Just select all root nodes for questions, then for each one, iterate through the subnodes using a for...each, or another xpath if you just want the questions, and then build each array that way.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ok, thanks I'll try that.
|
|
|
|
|
I assume im to use the XmlDocument Class as opposed to the XmlTextReader class.
I can select the root nodes by using:
XmlNodeList rootList = doc.GetElementsByTagName("problem");
foreach(XmlNode node in rootList)
....
How do I go about retrieving the child nodes? Do i use another XmlNodeList for the child nodes and then build the array within this loop?
Sorry Im new to reading Xml files and was using XmlTextReader initially.
I searched all over for documentation on how to read a Xml document into an array. But I can't find any examples that are similar to what I want to achieve. Any chance you could give me some example code??
Thanks.
|
|
|
|
|
It's a shame you're using Access, as SQL Server or MSDE would just generate XML for you.
foreach(XmlNode node in doc.SelectNodes(@"//problem"))<br />
{<br />
foreach(XmlNode subNode in node.ChildNodes) <br />
{<br />
}<br />
}
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'd like to write an Internet cafe program which has Address filter function. I want it like this: when user type something in the address bar of Internet Explorer window and press enter, the entered string will be sent to my program prior to IE itself, so I can manage bad addresses. What should I do?
|
|
|
|