Solved

Vb Grid

Posted on 2014-09-28
3
188 Views
Last Modified: 2014-10-01
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
0
Comment
Question by:Kevinfeening
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 20

Expert Comment

by:ElrondCT
ID: 40349293
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.
0
 

Author Comment

by:Kevinfeening
ID: 40349306
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
0
 
LVL 20

Accepted Solution

by:
ElrondCT earned 500 total points
ID: 40351540
You're doing it in the wrong order. Load happens when the form is first instantiated, so it's already happened before you use your SendVariables method. You can set each of the controls in SendVariables:
Public Sub SendVariables(byVal Empno, ByVal SDate, ByVal eDate)
' Set the Label text
label1.text = Empno
label2.text = sDate
datetimepicker1.text = eDate
end sub

Open in new window

You can also set the values directly, from the parent form, assuming the controls are declared Friend or Public (Friend is the default):
dim changeDate as New changeLeaveDate()
changeDate.label1.text = Empno
changeDate.label2.text = sDate
changeDate.datetimepicker1.text = eDate
changeDate.show()          ' Note the corrected name; show the instance, not the type

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question