|
PravinSingh wrote: any more ideas
No, not really. A web server should obviously know, but also not reveal, where the web root is. As I explained, you don't need to ask the user each time, once is enough (unless it changes). And that once could probably be at installation time of your app.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Since your site will always run on IIS, you can make the site an ASP.NET app and add a web service to the site that the calling app can call to ask for the information.
That's what you should be doing anyway....client apps shouldn't need direct access to that stuff.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Respected Seniors,
Kindly let me know one or two examples, How may I subtract / "Diffrence" time.
for example:
string strStudentTime = "10:00";
string strSystemTime = "10:15";
I need difference.
Thank you
(Riaz Bashir)
|
|
|
|
|
You can use Timespan[^] when need any kind of difference between two dates or time.
Regards,
Hiren.
-"I don't know, I don't care, and it doesn't make any difference".
|
|
|
|
|
As Hiren said, look at the TimeSpan class. Specifically, you'll need to read these values in (using TryParse) to a TimeSpan, and then you can get the difference from there.
|
|
|
|
|
You should not hold times, dates, or datetimes in strings; strings here are useful only for showing actual values to human users. Keep them in DateTime types instead, so you have all DateTime operators and methods available, including subtraction, which results in a TimeSpan.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
If it is a 24-hour clock, and the format is fixed as hh:mm, you can do it in a very simple way, without the system classes:
private static int ParseTime(string s) {
return 60*int.Parse(s.Substring(0, 2)) + int.Parse(s.Substring(3));
}
...
var diffInMinutes = ParseTime(strSystemTime) - ParseTime(strSystemTime);
If your code needs to be more robust than that, you should use DateTime to parse your strings, and then use the "-" operator to obtain their difference.
|
|
|
|
|
If you have a time then you should use TimeSpan.
If you have a timestamp then you should use DateTimeOffset (rather than DateTime.)
|
|
|
|
|
private int m_number;
public int My_NUM
{
get{ return m_number;}
set{m_number=value;}
}
----------
public int M_NUM2
{
get;
set;
}
when we can use of second way why we need to use of first way?
Thanks
|
|
|
|
|
The second way internally creates a version that matches the first, so in this simple case there's no need to do the first one. If your logic needs to do more though, then it becomes important to have the first form. The typical case here is where you have a property that needs to raise a PropertyChanged event when the value changes - you have to trigger this logic from the setter, so you need to do this.
|
|
|
|
|
As Pete already said, the second way is a shorthand for what you have in the first way, however the first way is much more powerful as you can add statements to the get and or the set method, maybe checking an input value and throwing an exception when it is unacceptable; maybe recalculating or repainting something (that is what the TextBox.Text setter would do).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Second way is property declaration in C# 3.0, for C# 2.0 you have to strict with first implementation.
If you want to do some validation in (get) and (set) then second way should not work. Like, on saving (set) a value you would like to check then you have to write validation code in set block.
private int m_number;
public int My_NUM
{
get{ return m_number;}
set{
if (value > 0)
m_number=value;
}
}
Regards
Rushi
|
|
|
|
|
The second form is also called as Auto Property.
|
|
|
|
|
Hi,
I have a datatable which is having 3 rows ,3 columns (min %,max%,default%)
and the values are string type and values are like 2%,5% etc...
now i want to remove percentage(%) in all the values in the table...ie the column values should be 2,5 etc...
Please help me regarding the same..
-- Modified Wednesday, May 11, 2011 2:19 AM
|
|
|
|
|
It is not clear. Could you clarify this problem?
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
I don't know you what actually you want to accomplish, But to just remove % you can loop through each rows and columns and use following.
table.Rows[i][j].ToString().Replace("%", String.Empty);
Regards,
Hiren.
-"I don't know, I don't care, and it doesn't make any difference".
|
|
|
|
|
Here are two suggestions:
1.
Each column of a DGV has a default style which you can alter; here is a typical statement doing that:
dgvArticles.Columns[DGVA_COL_BOOKMARKS].DefaultCellStyle.Format="#,###";
This would set the style of all data cells in one column, it probably is what you want.
For numbers you can specify different styles for positive, negative and zero values.
2.
Every time a cell is going to be recalculated for later painting, a DGV cell fires its CellFormatting event. You can assign a handler, that determines the style to be used at run-time, and this for individual cells. Here is another (partial) example:
private void dgvUsers_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) {
if (e.RowIndex...) {
if (e.ColumnIndex...) {
e.CellStyle.BackColor=Color.Gold;
}
}
}
FYI: both examples were inspired by actual code inside my "CP Vanity" article.
BTW: the above is NOT changing the value in the cells, it is only changing the way the cell content looks.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hi ,
How can we make sure that which part causes error in MStest failure. ?.Please let me know.
With Thanks regards.
|
|
|
|
|
Could you please be descriptive about the problem.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
I am working on the code part only.MSTest is written by some1 else.When I run the MStest after making changes to few files in a project , it is getting failed.I just want to know which change in which file triggering the error in MStest.Any idea ?
|
|
|
|
|
You will have to look at the test case which is failing and see which method it is testing. The error should be a clue.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
Show code and message.
More help would come.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Hi all,
In my system in a service is running at the backend.I want to use that service in my windows application how can i do it ?
An exe file for that service also i am having. But how can i use that service in my application.
Thanks in advance.
|
|
|
|
|
Is it a windows service? Or a web service?
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
Its a windows service which is already running, but i am not having any svc or any other file.Only exe file of that service is available.
|
|
|
|