views:

49

answers:

1

hii

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 then when an other form is opening it shud take that date...Is it possible..help me please

A: 

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

Serkan Hekimoglu
hii serkan first of all sorry for the delay in reply..but the code is not working it is not taking the particular date
amk
@amk its not problem. This is the best way to transfer values between forms. I am editing my reply, there is a second way
Serkan Hekimoglu
hello serkan i have tried the second way too but its still not working.I ll explain the scenario.actualy i didnt get the idea about"your DateTime".In my case i need to get the date from the xtrscheduler to the form that i have created.may be am asking too much..but help me please
amk
First of all, What is your question exactly? How to get value from xtrascheduler or How to pass variable to the new form from old form?
Serkan Hekimoglu
my question is how to get value from xtrascheduler
amk
OK I've installed Dev Express. But cant find XtraScheduler tool. Can you show me your code, and exact component name?
Serkan Hekimoglu
u need to install Devxpress v2010 vol 1.In that the controler used is scheduler control.u will be geting deatils from the demo.
amk
Ok I found the answer. Editing my answer, check pls :)
Serkan Hekimoglu