|
Thanks. That works.
Vasildb
|
|
|
|
|
HI,
I must formatting one String like VB6. How I can make?
Es.
Label1 = Format((Num - (Num \ 60000) * 60000) / 1000, "00.000")
Thanks
|
|
|
|
|
// assuming int Num;
double seconds=(Num%60000);
label1.Text=seconds.ToString("00.000");
Luc Pattyn
|
|
|
|
|
The formatting does not work correctly… if I set the number with .ToString(“00,000”) the result is always "nnnnn,000" ("n" is the integer number) … Why?
|
|
|
|
|
Because you are using a comma instead of a period in the formatting string. The period specifies the position of the decimal marker, regardless of what decimal marker is used.
---
Year happy = new Year(2007);
|
|
|
|
|
Thanks ..
|
|
|
|
|
First, let's make the VB6 code better:
Label1 = Format((Num Mod 60000) / 1000, "00.000")
Then we can translate it into C#:
Label1 = ((Num % 60000) / 1000).ToString("00.000")
---
Year happy = new Year(2007);
|
|
|
|
|
The formatting does not work correctly… if I set the number with .ToString(“00,000”) the result is always "nnnnn,000" ("n" is the integer number) … Why?
|
|
|
|
|
Because you are using a comma instead of a period in the formatting string. The period specifies the position of the decimal marker, regardless of what decimal marker is used.
---
Year happy = new Year(2007);
|
|
|
|
|
Thanks a lot ...
|
|
|
|
|
Guffa wrote: Because....
Don't you just hate repeating yourself.
|
|
|
|
|
sw.WriteLine("<body>"); <br />
sw.WriteLine("" + row["columnName1"]); sw.WriteLine("</body>")
The value columnName1 in this case is a static value. how can i make it dynamic? In my case, i have to give variable column names stored in an ArrayList.
sw.WriteLine("" + ArrayList[i]"]);
This gives an error in SQL that ArrayList doesn't match any column name in the database
|
|
|
|
|
Just replace the static string value with whatever you like:
sw.WriteLine("" + row[names[42]]);
Saira Tanwir wrote: sw.WriteLine("" + ArrayList[i]"]);
This gives an error in SQL that ArrayList doesn't match any column name in the database
Hardly. That code doesn't even compile...
---
Year happy = new Year(2007);
|
|
|
|
|
sw.WriteLine("" + row[names[42]]);<br />
I've already tried this. It doesn't work for me. Any other suggetions....??
|
|
|
|
|
No, there aren't any other suggestions, as that is how you do it.
If you want any help with the code that didn't work for you, you have to show it.
---
Year happy = new Year(2007);
|
|
|
|
|
You could iterate through the columns in the same way you do for the rows. Something like this:
sw.WriteLine("<body>");
foreach (DataRow row in myDataTable.Rows)
{
sw.Write("<p>");
foreach (DataColumn column in myDataTable.Columns)
{
sw.Write(row[column.ColumnName]);
sw.Write(" ");
}
sw.WriteLine()
}
sw.WriteLine("</body>");
|
|
|
|
|
Hi all,
I'm trying to track in intermittent exception that occurs in the code of some of my properties. What is the equivalent of
System.Reflection.MethodBase.GetCurrentMethod() for properties? I don't want to hard-code the property name in the catch section because there are a lot of properties in the solution. I'd rather use Reflection.
This is what I'm trying to do:
public bool Exists
{
get
{
try
{
// exception occurs here
}
catch(System.Exception ex)
{
ErrorLogger.Report(System.Reflection.MethodInfo.GetCurrentMethod(), ex); // Logs exception
}
return base.m_Exists;
}
}
Thanks in advance,
Vlad
|
|
|
|
|
use ex.TargetSite.Name property to get the name
public bool Exists<br />
{<br />
get<br />
{<br />
try<br />
{<br />
}<br />
catch(System.Exception ex)<br />
{<br />
ErrorLogger.Report( ex.TargetSite.Name,ex);
}<br />
return base.m_Exists;<br />
}<br />
}
|
|
|
|
|
hi every, one i have project which includes a windwos service and two windows apllication. the windos servcie have two dll files included.it all runs fine and every thing is ok but what i want to while making setup i want the dll files to be incuded in differnt folder and exe(executable) of windows service and windows application in one folder. and the confilg file of windows sevice in cofing folder how can i achle this with setup and deplyoment project of visula studio dot net 2003.
|
|
|
|
|
|
When I try to include a namespace in my programs, it comes up with an error, asking if I'm missing an assembly reference or something to that effect. I guess what I'm really asking is: How do I utilize namespaces in my programs?
---
A 13 Year Old Programming Wiz
The elementary kids were right!
"1" + "1' does = "11"!
|
|
|
|
|
You need to add a reference to the dll or application that holds the namespace. You should be able to right-click the project icon in the project explorer window and select Add Reference... then navigate to the dll whose namespace you wish to use. Then you will have access to the namespaces of the assembly and to use the namespaces, you can use the using namespace yaddaYadda;
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Thomas Stockwell wrote: Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Excellent quote...should be on a t-shirt somewhere.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
I'd like to generate C# front-end code automatically according to the database table structure, who can give me some guide how to do?
My thinking is just like:
In the database table 'Customers', there are one field 'Name' with the type 'VCHAR', one field 'ID' with the type 'LONG'. My program would generate the file 'CustomersView.cs' and 'CustomersView.Designer.cs' which contains one 'Label' of 'Name', one 'TextBox' of 'Name',one 'Label' of 'ID', one 'TextBox' of 'ID'.
Thanks in advance for you help.
|
|
|
|
|
As far as i know, you can generate the code dyanmically using ILEmit.. but i never tried that one.. Could u plz explain us, y do u need this funcnality.. insted. u could serialized the data store it in the database. and get it thru object and bind with front end controls.(winforms controls)
|
|
|
|