Page 1 of 1
Closing Form
Posted: Mon Sep 20, 2010 12:05 am
by jjc
Hi all,
when i close a StiForm to exit i noted the report begin to compile all records present in Database ,
How i can avoid this feature?
Thanks so much.
Have a good time.
Cheers
Closing Form
Posted: Mon Sep 20, 2010 12:35 am
by Alex K.
Hello,
You can set properties "Connect on Start" on DataSource to false.
Thank you.
Closing Form
Posted: Mon Sep 20, 2010 3:28 am
by jjc
Hi Aleksey ,thanks for your reply,
You can set properties "Connect on Start" on DataSource to false.
i tried to set properties "Connect on Start" on DataSource to false but when i need to choose the data to send to the report in the listboxs did not appear anything.
How i can work out this step?
Thanks so much for your advice.
have a good day.
Cheers
Closing Form
Posted: Mon Sep 20, 2010 5:42 am
by Alex K.
Hello,
If you set the "Connect on Start" to false, then, in this case, you need to obtain data for the forms manually.
For example:
Code: Select all
foreach (DataRow row in DataSource.Rows)
{
ListBoxControl1.Item.Add(row["ColumnName"]);
}
Thank you.
Closing Form
Posted: Tue Sep 21, 2010 12:04 am
by jjc
Hi Aleksey,
i set properties "Connect on Start" on DataSource to false(in this case City_TBL)
after in the form i inster this code to fill the ChecklistBox from City_TBL :
Code: Select all
if (ComboBoxControl1.SelectedIndex >= 0)
{
string index = Country_TBL.GetData("CountryCode", ComboBoxControl1.SelectedIndex).ToString();
CheckedListBoxControl1.Control.Items.Clear();
City_TBL.First();
while (!City_TBL.IsEof)
{
if (City_TBL.CountryCode == index)
{
foreach(DataRow row in City_TBL.Rows)
{
CheckedListBoxControl1.Control.Items.Add(row["CityCode"]);}
}
City_TBL.Next();
}
}
and when i click the button to load the data i receive this exception:
Unable to cast object of type "Stimulsof.Report.Dictionary.StiRow" to type "System.Data.DataRow".
Do i right the code or there is some error?
Thanks so much for your attention.
Have a good time.
Cheers
Closing Form
Posted: Tue Sep 21, 2010 4:41 am
by Alex K.
Hello,
Modify your code:
Code: Select all
if (ComboBoxControl1.SelectedIndex >= 0)
{
string index = Country_TBL.GetData("CountryCode", ComboBoxControl1.SelectedIndex).ToString();
CheckedListBoxControl1.Control.Items.Clear();
City_TBL.First();
while (!City_TBL.IsEof)
{
if (City_TBL.CountryCode == index)
{
foreach(Stimulsoft.Report.Dictionary.StiRow row in City_TBL.Rows)
{
CheckedListBoxControl1.Items.Add(row["CityCode"].ToString());
}
}
City_TBL.Next();
}
}
Thank you.
Closing Form
Posted: Tue Sep 21, 2010 11:00 pm
by jjc
Hi Aleksey,
i tried to correct the code as you post before but when did not load the data from the database.
I am so sorry for my bother however i am trying another solution too to work out this issue.
Thanks for your help.
Have a good day.
Cheers
Closing Form
Posted: Wed Sep 22, 2010 3:12 am
by Alex K.
Hello,
Sorry. Add also in this code:
City_TBL.Connect();
Thank you.