Solved

new in C#

Posted on 2011-09-16
2
259 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

749 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