Link to home
Start Free TrialLog in
Avatar of K Feening
K FeeningFlag for Australia

asked on

Vb Grid

Hi  

I have a Grid that shows selected Dates in Month is colour and any Staff Leave application in different colour
If the user clicks on a leave the program ask if the user wants to delete the leave Yes No

Dim Empno as String = Selected Employee Number from Table
Dim SDate as Sting = Start Date From Table
Dim EDate as String = End Date from Table

if Showmessage("delete Employee " & Empno & " from date " & Sdate " to Date " & eDate ) = Yes then
  Delete from Table
End if
  changeLeaveDate()
end if

how do I get the Empno, SDate and EDate to be seen in the ChangeLeave form
Avatar of ElrondCT
ElrondCT
Flag of United States of America image

If I understand you correctly, you want to put a date control (DateTimePicker?) into a DataGrid. I'm aware of three options:

1) Put a regular DateTimePicker into a DataGrid. One example of how to do this (and other types of controls) is at http://www.codeproject.com/Articles/9558/How-to-add-selection-controls-to-your-DataGrid

2) Buy a commercial control designed for this. I've liked Rustemsoft's DataGridColumns .NET assembly (www.rustemsoft.com).

3) Create your own class, using Inherits DataGridColumnStyle. MS actually provides an example of this on the DataGridColumnStyle class documentation page: http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridcolumnstyle%28v=vs.110%29.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2 shows .NET v4.5, but click on Other Versions if needed.

If I've misunderstood your need, my apologies. Perhaps if you describe a bit more about how your Grid is set up and how you're wanting to make changes, I can provide better assistance.
Avatar of K Feening

ASKER

Hi ElrondCT

Thanks No I don't need a timepicker

I worked out how to send the Variable values since email

The first Part of the code
if Showmessage("delete Employee " & Empno & " from date " & Sdate " to Date " & eDate ) = Yes then
   Delete from Table

Deletes the record correctly

I want to send the Empno SDate and eDate to a new form with 3 labels and  a Date picker already on it
if the user clicks NO to Delete Employee then using

dim changeDate as New changeLeaveDate()
changeDate.SendVariables(me.Empno, Me.SDate, Me.eDate
changeLeaveDate.show()

in the changeLeaveDate form I have

Public Sub SendVariables(byVal Empno, ByVal SDate, ByVal eDate)
empno, sDate and eDate all have the correct values
end sub

How do I use these variables in the
Public Sub changeLeaveDate_Load(ByVal Sender as System.Object, byVal e As System.EventArgs)

' Set the Label text
label1.text = Empno
label2.text = sDate
label3.text = "End Date"
datetimepicker1.text = eDate

End Sub
ASKER CERTIFIED SOLUTION
Avatar of ElrondCT
ElrondCT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial