Solved

new in C#

Posted on 2011-09-16
2
257 Views
Last Modified: 2012-05-12
Hi,

I am trying to learn C# from a VB background.
Normally in my classes I use a new sub to declare a new instance of the class objects. But when I try this in C# I run into all sorts of errors. Do you need to use the new sub in C# at all?
If you do, what would be the conversion for the code below?

Many thanks

Imports Obout.Grid
Imports System.Web.UI.WebControls

Public Class GridFactory

    Private GridFolderStyle As String

    Private Property _Grid As Grid

    Public Sub New()

        GridFolderStyle = ApplicationConfiguration.GridPath.ToString

        _Grid = New Grid()
        _Grid.Columns.Clear()

    End Sub
0
Comment
Question by:Soluga
2 Comments
 
LVL 2

Accepted Solution

by:
arundhaj earned 500 total points
ID: 36548158

import obout.Grid;
import System.Web.UI.WebControls;

public class GridFactory
{
      private String GridFolderStyle;
      private Grid _Grid;
      
      public void New()
      {
            GridFolderStyle = ApplicationConfiguration.GridPath.ToString();
            _Grid = new Grid();
            _Grid.Columns.Clear();
      }
}
0
 
LVL 1

Author Closing Comment

by:Soluga
ID: 36548178
Changed the import to using.
But great.
Thanks
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now