Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Help!! VB.NET Custom DataGridColumn Problem ...

Help!! VB.NET Custom DataGridColumn Problem ...

Scheduled Pinned Locked Moved Visual Basic
helptutorialcsharpgraphics
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    afphinfan1
    wrote on last edited by
    #1

    I am having a problem with the datagrid. I needed a columnstyle to display a email link for each contact that is displayed in the detail portion of a master-detail form. I found an example of a combobox and modified it for to a linklabel (oddly enough it works ... this surprised me because I am completely lost with inherit, override, overload, etc. I think I'm down to two problems: I can't figure out how to handle the clicked link (this is kind of important!) and I would like to be able to change the background color of the label to match the alternating row color. Thanks in advance for any help provided!! Mark Here is the code for the datagridlinklabel: (sorry for the length) Option Strict On Option Explicit On Imports System.Collections Imports System.ComponentModel Imports System.Drawing Imports System.Windows.Forms Imports System.Data Public Class DataGridLinkLabel Inherits LinkLabel Public Sub New() MyBase.New() End Sub Public isInEditOrNavigateMode As Boolean = True End Class Public Class DataGridLinkLabelColumnStyle Inherits DataGridColumnStyle ' ' UI constants ' Private xMargin As Integer = 2 Private yMargin As Integer = 1 Private dgLinkLabel As DataGridLinkLabel ' ' Used to track editing state ' Private OldVal As String = String.Empty Private InEdit As Boolean = False ' ' Create a new column - DisplayMember passed by string ' Public Sub New(ByVal DisplayMember As String) dgLinkLabel = New DataGridLinkLabel() With dgLinkLabel .Visible = False .Text = DisplayMember End With End Sub Public Sub New() dgLinkLabel = New DataGridLinkLabel() With dgLinkLabel .Visible = False End With End Sub '------------------------------------------------------ ' Methods overridden from DataGridColumnStyle '------------------------------------------------------ ' ' Abort Changes ' Protected Overloads Overrides Sub Abort(ByVal RowNum As Integer) Debug.WriteLine("Abort()") RollBack() HideLinkLabel() EndEdit() End Sub Protected Overloads Overrides Function Commit(ByVal DataSource As CurrencyManager, _ ByVal RowNum As Integer) As Boolean HideLinkLabel() If Not InEdit Then Return True End If Try Dim Value

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups