|
Thank u so much for the information.
Vipin
|
|
|
|
|
Guffa wrote: If you for an example have a string that sometimes contains a number, it's better to check the contents of the string before converting it than to use a try-catch to handle the times when it doesn't contain a number.
In these cases, you should really look at the TryParse methods. .NET 1.1 only had a few of these, but they have been expanded in .NET 2.0 to be included in more of the basic data types.
|
|
|
|
|
Using try/catch, try/finally, and try/catch/finally blocks are only expensive when an exception occurs. At that point, the runtime has to take a lot of steps to unwind all of the catch handlers to see who should respond to the exception.
Exceptions should only be thrown when something goes wrong, not to help control program flow. If you use them to try and control program flow, then it gets expensive (not to mention it's just bad practice).
Incidentally, if you have any using blocks
using (MemoryStream stream = new MemoryStream())
{
// do some work here
}
you are implicitly using a try/finally block. The C# compiler will automatically turn this into
MemoryStream stream = new MemoryStream();
try
{
// do some work here
}
finally
{
if (stream != null)
{
((IDisposable)stream).Dispose();
}
}
|
|
|
|
|
I would like to know how to loop the values of int of a single column of a datagrid (windows forms) and sum them. C#
|
|
|
|
|
Hope that this will help.
CurrencyManager cm = (CurrencyManager)grid.BindingContext[grid.DataSource,grid.DataMember];<br />
int numRows = cm.Count ;<br />
DataView dv = (DataView)cm.List ;<br />
<br />
string cols=string.Empty ;<br />
for(int i = 0 ; i < cm.Count ; i++)<br />
{<br />
<br />
}
sorry for my bad English.
|
|
|
|
|
I've managed to do it myself but anyway thanks very much
P.S. sorry for my English too.
choopie
|
|
|
|
|
You are welcome.
sorry for my bad English.
|
|
|
|
|
Hello,
i'm working on a program to test the access of a certain user on a folder.
I user an existing class that i found on this site but i need to give an object of the WindowsIdentity class. I can test it on my own as logged in user but i need also be able to check on other users. Is there a way to make WindowsIdentity objects by the name or SID of the user (or NtAccount)? Or any other way to make a WindowsIdentity object for a user?
I'm already searching for this for a long time for this but have not found a solution yet.
Kind regards,
Frederik
Hope someone could help me
|
|
|
|
|
I think there is only one way. Read this:
http://support.microsoft.com/kb/180548/
Just compile it and use it in C# using DllImport.
|
|
|
|
|
The extract of my previous question: how to set read-only properties of the Outklook.PostItem object, exactly SenderName and ReceivedTime? (I devdelop outlook 2003 add-in in c#)
I found one way - http://www.outlookcode.com/codedetail.aspx?id=1112, but ot works incorrectly when i'm trying to set PR_SENDER_NAME.
May be other PR_ properties? Or, maybe, over way at all?
|
|
|
|
|
hello every one,
well I'm working on making a master detail form here. I've binded the data correctly and now I want to add the update, del, and insert new record functionality to the detail form. I'm using .net 2.0 C# and I'm working in windows Forms. I've used DataGridView class to display the detail data information.
For saving the record, I wanted to cast the datasource of DataGridView into a datatable first and then use it to iterate thru the data but it returns a null so I get the nullreferenceException. Plz tell me how to iterate thru the detail table here.
I actually deleted a few columns from the detail table ;like the PK columns and Foreign Key columns coz the user doesnt need to see those. But I do wanna have access to those esp when updatin the record. So what can I do.
if its possible plz give me a sample code or application if u can.
thanks in advance...
Rocky
|
|
|
|
|
You have to add both the tables in a dataset and then add realtionship to the priamry and foreign keys of these tables in DataSet.Relations.
2nd thing, dont delete those colunms, just make them invisble to user or make them read only.
sorry for my bad English.
|
|
|
|
|
thanks alot, I've almost managed that by now. and I deleted those columns as well.
now theres only onw nullreference Exception left. I'll deal with that pretty soon as well.
thanks
|
|
|
|
|
Hello! I/m developing Outlook 2003 add-in in c#? so I have some queer problems.
As you know, SenderName and ReceivedTime properties of PostItem object are read-only, so if you create such item programmatically, you'll see "Unknown".
Question is: are there any ways to set these properties? I've found one - MAPI. I set PR_SENDER_NAME,
but it works queer: if i open postitem i see my phrase, but in the message folder i see "unknown" in the title of each postitem. ()
And i tryed to set RecievedTime in such a way - in vain.
I would greatly appreciate any help!
If anybody can help, i can show the code.
Looking forward for your answers!
|
|
|
|
|
Hi,
I declared a hidden field in my .aspx page like such:
<asp:HiddenField id="hdnHubID" runat="server" />
I populated the value property of the hidden field like such:
hdnHubID.Value = objOrder.Hub.ToString(); // Contains the integer hub ID
And I tried retrieving the value like this:
int intHubID = Int32.Parse(Request.Form["hdnHubID"]);
Then I get the following error in my browser:
System.ArgumentNullException: Value cannot be null.
Parameter name: String
... and it hightlights int intHubID = Int32.Parse(Request.Form["hdnHubID"]); in red.
What is this error and why am I getting it??
Regards,
ma se
|
|
|
|
|
why are not using hdnHubID.Value to retrieve the value.
try
int intHubID = Int32.Parse(hdnHubID.Value);
Regards
Shajeel
|
|
|
|
|
Thanks, but I don't understand the difference between the 2. The reson why I took Request.Form was because I am populating text fields depending on what winery is selected from the drop down, but the hub ID will always remain the same.
|
|
|
|
|
You have declared it as server side so it is available to you without Request.Form. i have .net 1.1 so i can't code it right now. but i think it will also be avialable from Request.Form. the main difference b/w the 2 is Request.Form is used when the control is client side and you dont have any access to it from your class.
Regards
Shajeel
|
|
|
|
|
You're gettind a null reference exception becaue the Request.Form["hdnHubID"] is unable to retrieve to control and it returns null which is passed to Int32.Parse that expects a string. You should check for null reference exceptions.
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
I am working with C#.net and i want to extract all the projects path that are stored inside the solution file and i also want to read the number of projects that are references and those that are associated with the Source safe control.
Plz help me as soon as possible.
|
|
|
|
|
open the the sln file with a text editor and it`s easy enough to find out the format of a sln file. So you could write a parser yourself if you will.
The references of each project you can get from their respective .csproj file, which is an XML file, even easier to parse that...
A nice tool that interprets all that for you is Visual Studio, really cool tool, and it has a nice GUI that makes it easy to find the references of each project and such
Greetz,
Davy
|
|
|
|
|
Hi,
What class/Method can be used as an equivalent for PixelGrabber in Java?
i need to retrieve the subset of pixels from an Image in Windows Application
Kindly tell me..
Thanx..
|
|
|
|
|
Read my image processing articles.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
What is the difference between const and read-only variable?
|
|
|
|
|
Consts must be asigned at compilation; this means that every time you run the programe they have the same value.
Read only can be asigned a value when they are declared and they can't be changed afterwards; this works "readonly int j=i" where i is a variable. So j can have different values the programe is run;
|
|
|
|