|
Your definition of the IAnimal interface is incorrect. Try:
public interface class IAnimal {
void Eat(String^ food);
};
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Thanks Tom.
The best way to accelerate a Macintosh is at 9.8m/sec-sec.
- Marcus Dolengo
|
|
|
|
|
Hi All,
I have one HTML Table. Table has 3 rows and 2 columns. It is just like this:::::
COL 1 COL2
+++++++++++++++++++++++++++++++++
Label1 Label1.Text
Label2 Label2.Text
Label3 Label3.Text
+++++++++++++++++++++++++++++++++
Now I want to take this information into DataTable by dynamically adding columns and rows to DataTable. Means in the 1st column, name of the labels and in the 2nd column,Labels's Text field. Plz give me the idea about it.
I m working on .net 1.1 + c#
Thank you............
Keep Smiling...........
|
|
|
|
|
vhs17 wrote: Now I want to take this information into DataTable by dynamically adding columns and rows to DataTable.
You've answered your own question. Now all you need to do is write some code.
The MSDN documentation[^]shows you how to do this.
Paul
|
|
|
|
|
Hi Paul,
Thank you for reply. I have tried this code. But it gives me error.
<br />
DataTable dt3 = new DataTable();<br />
DataColumn dc1 = new DataColumn("Col_1",System.Type.GetType("System.String"));<br />
DataColumn dc2 = new DataColumn("Col_2",System.Type.GetType("System.String"));<br />
for(i=0;i<=2;i++)<br />
{<br />
dr = dt3.NewRow();<br />
dr["Col_1"] = "TOTAL less GST";<br />
dr["Col_2"] = lbl_total_less_GST.Text; <br />
dt3.Rows.Add(dr);<br />
} <br />
<br />
dt3.Columns.Add(dc1);<br />
dt3.Columns.Add(dc2); <br />
<br />
can you plz tell me where I m wrong???
Thank you
Keep Smiling ...............
-- modified at 7:24 Saturday 22nd September, 2007
|
|
|
|
|
|
Hi Paul,
Thank you for reply again. But I have done this like following:
<br />
DataTable dt3 = new DataTable();<br />
dt3.Columns.Add("TOTAL less GST");<br />
dt3.Columns.Add("GST"); <br />
dt3.Rows.Add(new string[] {"TOTAL less GST",lbl_total_less_GST.Text});<br />
dt3.Rows.Add(new string[] {"GST",lbl_GST.Text});<br />
dt3.Rows.Add(new string[] {"TOTAL",lbl_TOTAL.Text});<br />
Actually my table structure is static only label's text is variant. So i have done this.
thank you.
Keep smiling........
|
|
|
|
|
You're original code didn't make logical sense and there were undefined variables which prevented it from compiling.
I changed it to the following, which works:
DataTable dt3 = new DataTable();
DataColumn dc1 = new DataColumn("Col_1", System.Type.GetType("System.String"));
DataColumn dc2 = new DataColumn("Col_2", System.Type.GetType("System.String"));
dt3.Columns.Add(dc1);
dt3.Columns.Add(dc2);
DataRow dr = dt3.NewRow();
dr["Col_1"] = "TOTAL less GST";
dr["Col_2"] = lbl_total_less_GST.Text;
dt3.Rows.Add(dr);
dr = dt3.NewRow();
dr["Col_1"] = "GST";
dr["Col_2"] = lbl_GST.Text;
dt3.Rows.Add(dr);
dr = dt3.NewRow();
dr["Col_1"] = "Total";
dr["Col_2"] = lbl_TOTAL.Text;
dt3.Rows.Add(dr);
Paul
|
|
|
|
|
You must add DataColumn objects to a table before you bind to them. Also you have another error which will not be catched by any compiler. Make meaningful names! Col_1 and Col_2 tells nothing!
I would do it like this:
DataTable table = new DataTable();
table.Columns.Add("Name", typeof(string));
table.Columns.Add("Text", typeof(string));
DataRowView dr;
for (int i = 0; i < 10; i++) {
dr = table.DefaultView.AddNew();
dr["Name"] = "Name " + i.ToString();
dr["Text"] = "Some text no. " + i.ToString();
}
table.AcceptChanges();
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Is the "double" type is faster than "float" type in .Net when using them in loops?
I sensed in my experience that it is true. somebody has any idea about it?
and why it must be true?
thank you
|
|
|
|
|
small_programmer wrote: Is the "double" type is faster than "float" type in .Net when using them in loops?
I sensed in my experience that it is true. somebody has any idea about it?
and why it must be true?
double and float have different precisions. Performance is not something I've ever taken into consideration when deciding to use one over the other.
I'm guessing that if you've seen double as being faster it is probably because the processor's native floating point representation is a double and float s (although they save memory) will be slower as a result because the processor converts them internally to double s, processes it then converts it back. But, that is just my guess.
|
|
|
|
|
Thank you
I think you are right.
|
|
|
|
|
Colin Angus Mackay wrote: I'm guessing that if you've seen double as being faster it is probably because the processor's native floating point representation is a double and floats (although they save memory) will be slower as a result because the processor converts them internally to doubles, processes it then converts it back. But, that is just my guess.
That would be to line up on the word boundaries, I've always thought.
"Try asking what you want to know, rather than asking a question whose answer you know." - Christian Graus
|
|
|
|
|
Hi Paul,
I am sure it is not related to memory alignment: double alignment is not
more relaxed than float alignment. If there is any difference in performance, one
should have a look at actual code (assembly rather than MSIL); it could prove
Colin's guess is right.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hmmm, I think I might just write up a quick little app to do a fun little weekend investigation
"Try asking what you want to know, rather than asking a question whose answer you know." - Christian Graus
|
|
|
|
|
Hi Paul,
any interesting results in your float/double perfo investigation?
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Nothing really outstanding at this point. Seems to be a push between the two.
|
|
|
|
|
Colin Angus Mackay wrote: I'm guessing that if you've seen double as being faster it is probably because the processor's native floating point representation is a double and floats (although they save memory) will be slower as a result because the processor converts them internally to doubles, processes it then converts it back. But, that is just my guess.
It's correct that the processor does all operations internally using doubles. Which ever type is faster also depends on several other factors, though. If you for example process an array of numbers, floats may be faster than doubles just because more of them fits in the processor cache.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi
for floating point operations Double is the most efficient type because those operations are optimized by hardware.
|
|
|
|
|
thank you all.
look at these codes
1.
for(int i=0;i<100000000;i++)
{
float f1=i/357;
float f2=i/546;
if(f1>f2/3454)
{
f2=f1;
}
}
2.
for(int i=0;i<100000000;i++)
{
double f1=i/357;
double f2=i/546;
if(f1>f2/3454)
{
f2=f1;
}
}
the first code consume 7.27 sec and second code consume 6.73 sec in my computer.
of course assignment statement is high time consumer.
somebody has any idea about it?
|
|
|
|
|
Is it possible to send xml data contains folder information from windows service to web application , if it is possible please help me
thanks in advance
|
|
|
|
|
I have a user-defined control which has as a child control a TextBox (.NET 3.0). When I call Focus() on this TextBox, it doesn't work. However, if I add a MessageBox.Show() line, and then call Focus(), it does indeed Focus on the TextBox. I'm not sure what is happening here - focusing on a different control, and then on the TextBox, doesn't seem to produce the same effect. Can anybody point out my (probably obvious) mistake?
|
|
|
|
|
Try to call Focus() on the user control first. Where did you add the MessageBox.Show() line?
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
The code is like this:
<br />
LineControl newLineControl = GetControlForLine(newLine);<br />
MessageBox.Show("try now"); <br />
newLineControl.Dialogue.Focus();
I tried adding newLineControl.Focus() before newLineControl.Dialogue.Focus() as suggested, but it didn't make a difference.
I tried logging when each control gets and loses focus, and got the following result when clicking on a LineControl (my user control):
TextBox got focus
LineControl got focus
..then away from it:
TextBox lost focus
LineControl lost focus
This was the same regardless of whether the MessageBox.Show() line was included, yet when that line is included, newLineControl.Dialogue.Focus() works, and when it isn't, it doesn't. Any ideas? Very confused.
|
|
|
|
|
Hi All,
I want to save the data in the textboxes of a form, in an excel sheet programmatically.
I know it to do using datagridview....but i dont get any idea as to how to transfer the data in textboxes to the excel sheet.
Please Help Me.
Regards,
Priya
|
|
|
|