Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7768079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:49:49+00:00 2026-06-01T15:49:49+00:00

I am trying to use some C# code that expands on the GridView functionality

  • 0

I am trying to use some C# code that expands on the GridView functionality in a VB.NET project. The code I’m using is from here.

In the C# code there is an event definition for GroupHeader:

/// <summary>
/// Event triggered after a row for group header be inserted
/// </summary>
public event GroupEvent GroupHeader;

This is expanded by example on the above web site:

protected void Page_Load(object sender, EventArgs e)
{
    GridViewHelper helper = new GridViewHelper(this.GridView1);
    helper.RegisterGroup("ShipRegion", true, true);
    helper.RegisterGroup("ShipName", true, true);
    helper.GroupHeader += new GroupEvent(helper_GroupHeader);
    helper.ApplyGroupSort();
}

private void helper_GroupHeader(string groupName, object[] values, GridViewRow row)
{
    if (groupName == "ShipRegion")
    {
        row.BackColor = Color.LightGray;
        row.Cells[0].Text = "&nbsp;&nbsp;" + row.Cells[0].Text;
    }
    else if (groupName == "ShipName")
    {
        row.BackColor = Color.FromArgb(236, 236, 236);
        row.Cells[0].Text = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + row.Cells[0].Text;
    }
}

My question is, how do I convert this code to VB.NET?

I have converted the event implementation like so:

Private Sub helper_GroupHeader(ByVal groupName As String, ByVal values As Object(), ByVal row As GridViewRow)
    Try
        If groupName = "ITEM#" Then
            row.BackColor = Color.LightBlue
            row.Cells(0).Text = "&nbsp;&nbsp;" & row.Cells(0).Text
        End If
    Catch ex As Exception

    End Try
End Sub

How can I then call (raise?) this event with VB.NET?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:49:50+00:00Added an answer on June 1, 2026 at 3:49 pm

    You’re looking for AddHandler:

    Protected Sub Page_Load(sender As Object, e As EventArgs)
        Dim helper As New GridViewHelper(Me.GridView1)
        helper.RegisterGroup("ShipRegion", True, True)
        helper.RegisterGroup("ShipName", True, True)
        AddHandler helper.GroupHeader, AddressOf helper_GroupHeader
        helper.ApplyGroupSort()
    End Sub
    

    I assume that the event is implicitely raised from GridViewHelper.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert some code from Richfaces 4 showcase to use CDI instead
I have some test code that i'm just trying to use to figure out
I am currently trying to use Eclipse to develop some code that I've been
I'm trying to use some code that I wrote on another computer that splits
I have some legacy code that I am now trying to re-use under Spring.
I'm trying to use some code like this, and it's failing: data = Range(A1)
I am trying to use some rails code withing a javascript and need to
I am trying to use some sample code and my compiler won't compile this
I am trying to use some Facebook code in one of my pages. The
I'm trying to use ResolveUrl() to set some paths in the code behind of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.