I am using devexpress xtrascheduler in that i need to get the date n the next form while clickin on a particular date on the xtrascheduler
for example if i am clicking on a cell having date 02-06-2010 开发者_如何学JAVAthen when an other form is opening it shud take that date...Is it possible..
Yes of course it is possible. Just take xtrascheduler value before opening new page, and set DateTime date;
Go to other form's code. you have a line like
public MyForm()
{
InitializeComponents();
}
add this lines too, and declare a variable at global, and set it to incoming date like,
DateTime incomingDate = new DateTime(); // This is in the global
public MyForm(DateTime date)
{
incomingDate = date;
InitializeComponents();
}
so now, when you tried to open your new form, the datetime parameter will be asked like,
MyForm frm = new MyForm(date);
frm.Show();
---------- second way
Form FirstForm = Your main form
Form SecondForm = Your second form which date will be transferred to this form
At form SecondForm:
public SecondForm(FirstForm x) // Request first form to opening
{
InitializeComponents();
}
set your datetime value to a variable in FirstForm. Lets say
// located global of your FirstForm
public DateTime abc = yourDateTime;
declare new FirstForm at SecondForm global like:
public FirstForm myFirstForm; // this is in the second form global
at this part use this:
public SecondForm(FirstForm x)
{
InitializeComponents();
myFirstForm = x; // So now you can reach myFirstForm.abc which is your dateTime
}
just send this parameter in the first form before opening
SecondForm frm = new SecondForm(this);
frm.Show();
Scheduler Control
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using DevExpress.ExpressApp.Scheduler.Win;
using DevExpress.Persistent.Base.General;
using DevExpress.XtraScheduler;
namespace HowToAccessSchedulerControl.Module.Win {
public partial class SchedulerController : ViewController {
public SchedulerController() {
InitializeComponent();
RegisterActions(components);
}
private void SchedulerController_Activated(object sender, EventArgs e) {
if(View.ObjectTypeInfo.Implements<IEvent>())
View.ControlsCreated += new EventHandler(View_ControlsCreated);
}
void View_ControlsCreated(object sender, EventArgs e) {
// Access the current List View
ListView view = (ListView)View;
// Access the View's List Editor as a SchedulerListEditor
SchedulerListEditor listEditor = (SchedulerListEditor)view.Editor;
// Access the List Editor's SchedulerControl
SchedulerControl scheduler = listEditor.SchedulerControl;
// Set the desired time to be visible
if (scheduler != null)
scheduler.Views.DayView.VisibleTime =
new TimeOfDayInterval(new TimeSpan(6, 0, 0), new TimeSpan(11, 0, 0));
}
}
}
and also see this information might help you and there are properties you need
精彩评论