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. Label inside Rectangle

Label inside Rectangle

Scheduled Pinned Locked Moved Visual Basic
csharphelp
2 Posts 2 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
    adairjk
    wrote on last edited by
    #1

    I am trying to add a month view calendar that will display the time and description of the event within each day (using VB.NET 2005). My current attemt is to draw a series of rectangles and place text within each. I am able to create my calendar, put the day inside each box...so the calendar is there. My problem is placing a label, text, etc. within each box to display the event. I would also need to be able to double-click the item and open a form containg the detail for the item. If someone could point me in the right direction (even if it means starting over and taking a new path) I would greatly appreciate it. Many thanks in advance. -- modified at 21:55 Monday 16th October, 2006

    D 1 Reply Last reply
    0
    • A adairjk

      I am trying to add a month view calendar that will display the time and description of the event within each day (using VB.NET 2005). My current attemt is to draw a series of rectangles and place text within each. I am able to create my calendar, put the day inside each box...so the calendar is there. My problem is placing a label, text, etc. within each box to display the event. I would also need to be able to double-click the item and open a form containg the detail for the item. If someone could point me in the right direction (even if it means starting over and taking a new path) I would greatly appreciate it. Many thanks in advance. -- modified at 21:55 Monday 16th October, 2006

      D Offline
      D Offline
      Dave Sexton
      wrote on last edited by
      #2

      You can create them dynamically in code. Declare the label outside of any subs using the "WithEvents" keyword - this will allow you to attach a double-click event to the label through making use of the AddHandler method. You will have to add your own code to determine how many labels you'll need, I've just used a loop to demonstrate.

      Private WithEvents lblEvent As Label

      Private Sub MySub()'dynamically add labels
      Dim i As Integer
      Do Until i = 30
      lblEvent = New Label
      lblEvent.Text = "Event Label " & i.ToString
      AddHandler lblEvent.DoubleClick, AddressOf lblEvent_DoubleClick
      'add the label to a control
      Me.Controls.Add(lblEvent)
      Loop
      End Sub

      Private Sub lblEvent_DoubleClick(ByVal sender As Object, _
      ByVal e As System.EventArgs) Handles lblEvent.DoubleClick
      'add processing here
      End Sub

      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