Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

Accessing public methods without creating object...


In VB.NET I have a Class file (called Common) with some code:

Public Shared Sub BindCombos()
End Sub

I could then populate a combobox by doing:

Common.BindCombos(param1, 2 etc)

And this was enough.

I tried doing this in C# and it will not let me do this.

In C# I have to create an object from the class:

Common myCbo = new CommonUtils();
myCbo.BindCbos(param1, 2 etc);

Compiles and runs but is not doing the job i.e. not populating my control.

How can I just create a separate class/code file that has generic functions I can call??


Ramesh Srinivas
Ramesh Srinivas
1 Solution
Public Shared Sub BindCombos()

in C#:

public static void BindCombos()

Ramesh SrinivasTechnical ConsultantAuthor Commented:
Lovely jubbly!

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now