.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Some help regard csharp

Posted By:      Posted Date: August 23, 2010    Points: 0   Category :ASP.Net


I am new in Csharp but worked in VB. I have done a web application but my PM says following things i corrected my code and please compare following rules with my Code if i am wrong???

    *  Try to initialize variables where you declare them.

    * Always choose the simplest data type list or object required.

    * Always use the built-in C# data type aliases. Not the .Net Common Type System (CTS) E.g.

           short instead of System.Int16

           int instead of System.Int32

           long instead of System.Int64

           string instead of System.String

          o Only declare member variables as private. Use properties to provide access to them with public, protected or internal access modifiers.

          o Try to use double for fractional numbers to ensure decimal precision in calculations.

          o Only use float for fractional numbers that will not fit double or decim

View Complete Post

More Related Resource Links

Want to Create Table Dynamically With text Control in WinForm Csharp

Hello To All... from Many Days i m tryng to create a simple table using csharp in WinForm.Which will include textbox in each cell according the Passed No of Col & Row. but not getting the proper result. Actually i want to trace each cell data and want to save each cell data to data base : eg. in cell 11(1col & 1row) i m having Combobox which having some item list and when the user select the list item the data will save to the database. Regards, Praveen    What is the Key of Life ... Its Sharing Your Thought & Knowledge ...

SharePoint 2010 - noticed a possible bug with regard to custom site templates.

Hi All, I'm wondering has anyone else noticed this behaviour in relation to custom site templates. I wanted to move an site A ( content included ) from site collection A to site collection B. I saved site A as a site template ( content included ) I uploaded the site template to site collection B's solution gallery. I created Site B on site collection B using this site template. unfortunately the top links to site A have been preserved causing major confusion to the users. i.e. the shared documents document library link and the tasks link both link to Site A! the links to documents within the document library on the other hand are to site B!? Is this a known issue ? Is this something that I should have expected to happen? look forward to hearing other folks experience with this functionality. thanks and regards, Counie  

Calling csharp code from Javascript

Hi, Is it possible to call a c# code block from Javascript in Sharepoint 2010? I am using redirects to pages at the moment to achieve the effect, but the results are far from desirable. Any help would be much appreciated.   Cheers, M

Can not read webpage in csharp (Ajax)


Hi, Guys.

I try to read a web page but i does not works.

Here is code from internet


using System.Net;
using System.IO;
using System.Windows.Forms;

string result = null;
string url = "http://www.devtopics.com";
WebResponse response = null;
StreamReader reader = null;

 HttpWebRequest request = (HttpWebRequest)WebRequest.Create( url );
 request.Method = "GET";
 response = request.GetResponse();
 reader = new StreamReader( response.GetResponseStream(), Encoding.UTF8 );
 result = reader.ReadToEnd();
catch (Exception ex)
 // handle error
 MessageBox.Show( ex.Message );
 if (reader != null)
 if (response != null)


I tested with this url http://priceboard.fpts.com.vn/user/stock/hcm3/?s=31&rd=r15332110001

It is a Price Board.

Content result is lack of content data. Help me fix it.


Thanks in advanced!.


Convert asp classic to Csharp



Hi All,

count= len(passwrd)


myarray(count)=Asc(myarray(count)) Xor Asc(bit1)


The statement above is written in asp classic vb.

Anyone can convert it to c# asp.net or not ?

I have tried to use

myarray[count] = strPassword.Substring(count, 1);


Convert.ToString(Convert.ToInt32(myarray[count]) ^ Convert.ToInt32(myarray[Convert.ToInt32(bit1)]));Convert.ToString(Convert.ToChar(myarray[count]));


But threw me an error : System.FormatException: Input string was not in a correct format


Thanks in

Csharp webbrowser Abnormal


Csharp Source  

                        SHDocVw.WebBrowser wb = this.webBrowser1.ActiveXInstance as SHDocVw.WebBrowser;
                        wb.NavigateComplete2 += new SHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(wb_NavigateComplete2);

A Source URL handling :

<input type="button" value="submit" class="dpl-btn" id="submitFormBA" onclick="submitForm()" />

B Source URL handling :

<input type="button" name="Preview" class="dpl-btn-blue" id="btnPreview" value="preview" onclick="previewPage()"/><

How to read XML file data in csharp?


how to read xml content in csharp XDocument.Load()

setup and deployment win app Csharp and sql server


Can anyone guide me how can i deploy my project which contains win app developed in Csharp front-end  and sql server as back-end. what i want is to make setup on my client system which has no visual studio and sql server. please this is urgent please HELP!



Problem opening list RSS through Csharp code



I'm trying to write an application page that loads the RSS feed from a list inside the same SharePoint environment (but in another site collection).
The SharePoint environment uses basic authentication (based on Active Directory).
I do this by using the HttpWebRequest object and I pass through CredentialCache.DefaultNetworkCredentials to authenticate when opening the RSS feed, in order to pass through the credentials of the currently logged on user.

On my test environment this seems to work good. Before I got "unauthorized", and when passing the credentials it would show me the RSS feed.
Now I moved my code to another development server, and there this fails, it still gives me "unauthorized" while I can open the RSS feed manually without any problems. When trying to print the username that is passed through it returns an empty string. I found out on Google that DefaultNetworkCredentials always returns empty values for username/domain/password, but how can I possibly know then what credentials are passed through ???

Or do I have to follow another approach in order to load a list RSS feed that requires authentication ?
I cannot use a fix username/password, as I need to load the RSS feed under the same credentials as the user who opens the application page.

Thanks in advance!

Crystal report passing parameters to sub report from csharp

Im not being able to pass parameters to the subreport C# below is the code, i dont want the popop of parameters to appear.
Development environment is CSharp, using Crystal reports and SQL. Both reports parent and sub report has the same parameters.
Anyone can help?

     public void PrintReport(ReportDocument crReportDocument, string ReportTitle, string ReportSpName)

Create Webservices for Existing Csharp Code written in web application


Dear All,


I have requirement to create webservices for existing c# code written in asp.net...do i need to create web methods for all functions used in web application???????? please do needful..

access dataset value in cSHARP


how to access dataset value in C# without using foreach (datarow dr in ds) {    }

I mean something like this in vb.net : ds.tables(0).rows(0).items("fiedlname").tostring


thank you

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend