StrataFrame Forum

NAvigation goes to edit mode

http://forum.strataframe.net/Topic29850.aspx

By Robert Craill - 4/7/2011

Hi There,

Made a customer form and applied CustomerBo. I have another BidtableBO. Relation ship setup on customer.bid=bidtable.bid ( char(5))

Firstly bidtable fields only have message - threw exception . I followed the steps to create the relationship but seems i missed something. Any ideas where to look.

Second, my form when i open it, goes straight to edit mode. But the edit button is still active and nav buttons deactivated.
If i click edit then undo then the  nav buttons are active but then on the fourth "next" click the form auto enters edit mode but the buttons dont reflect this ie edit active undo not active but nav buttons deactivated.

Strange one.

Any advice where to look.

Regards

Robert
By Ivan George Borges - 4/8/2011

Hi Robert.

A bit difficult to tell without having a sample to look at.

What I would look for is if anything could be changing values at navigation in your code, that being in the BO or the form itself.

Just to get the way of things, have you followed the Tutorial that comes with the Help file?
By Robert Craill - 4/10/2011

Hi ivan,

on customer form

public Customer()
{
InitializeComponent();
this.ManualComboLoad();
customerBO1.FillDataTable("select * from customer");
}


if i comment out this.ManualComboLoad(); then form runs correctly.If it runs then the form goes straight to edit mode but does not highlight or activate undo button.

 

i have a few combo boxes on form,

here is sub

private void ManualComboLoad()
{
//-- Create dropdowns from manaul tables then populate comboboxes
DataTable loTable = new DataTable();
DataRow loRow;
//-- Create the table structure
loTable.Columns.Add("Number", typeof(string));
loTable.Columns.Add("Acctype", typeof(string));
//-- Add some rows
loRow = loTable.NewRow();
loRow["Number"] = "1";
loRow["Acctype"] = "Cheque";
loTable.Rows.Add(loRow);
loRow = loTable.NewRow();
loRow["Number"] = "2";
loRow["Acctype"] = "Savings";
loTable.Rows.Add(loRow);
loRow = loTable.NewRow();
loRow["Number"] = "3";
loRow["Acctype"] = "Transmission";
loTable.Rows.Add(loRow);
loRow = loTable.NewRow();
loRow["Number"] = "4";
loRow["Acctype"] = "Bond Account";
loTable.Rows.Add(loRow);
loRow = loTable.NewRow();
loRow["Number"] = "6";
loRow["Acctype"] = "Subscription Share Account";
loTable.Rows.Add(loRow);
//-- Associate the table with the combos data source
cboAccType.DataSource = loTable;
cboAccType.DisplayMember = "Acctype";
cboAccType.ValueMember = "Number";
cboAccType.DropDownMember = "Acctype";
DataTable loFrequency = new DataTable();
DataRow loFreqRow;
//-- Create the table structure
loFrequency.Columns.Add("Freq", typeof(string));
loFrequency.Columns.Add("Display", typeof(string));
//-- Add some rows
loFreqRow = loFrequency.NewRow();
loFreqRow["Freq"] = "01";
loFreqRow["Display"] = "Monthly";
loFrequency.Rows.Add(loFreqRow);
loFreqRow = loFrequency.NewRow();
loFreqRow["Freq"] = "03";
loFreqRow["Display"] = "Quarterly";
loFrequency.Rows.Add(loFreqRow);
loFreqRow = loFrequency.NewRow();
loFreqRow["Freq"] = "06";
loFreqRow["Display"] = "Half Yearly";
loFrequency.Rows.Add(loFreqRow);
loFreqRow = loFrequency.NewRow();
loFreqRow["Freq"] = "12";
loFreqRow["Display"] = "Annually";
loFrequency.Rows.Add(loFreqRow);
cboFreq.DataSource = loFrequency;
cboFreq.DisplayMember = "Display";
cboFreq.ValueMember = "Freq";
cboFreq.DropDownMember = "Display";
DataTable lomonth = new DataTable();
DataRow lomonRow;
//-- Create the table structure
lomonth.Columns.Add("month", typeof(string));
//-- Add some rows
lomonRow = lomonth.NewRow();
lomonRow["month"] = "01";
lomonth.Rows.Add(lomonRow);
lomonRow = lomonth.NewRow();
lomonRow["month"] = "02";
lomonth.Rows.Add(lomonRow);
lomonRow = lomonth.NewRow();
lomonRow["month"] = "03";
lomonth.Rows.Add(lomonRow);
lomonRow = lomonth.NewRow();
lomonRow["month"] = "04";
lomonth.Rows.Add(lomonRow);
lomonRow = lomonth.NewRow();
lomonRow["month"] = "05";
lomonth.Rows.Add(lomonRow);
lomonRow = lomonth.NewRow();
lomonRow["month"] = "06";
lomonth.Rows.Add(lomonRow);
lomonRow = lomonth.NewRow();
lomonRow["month"] = "07";
lomonth.Rows.Add(lomonRow);
lomonRow = lomonth.NewRow();
lomonRow["month"] = "08";
lomonth.Rows.Add(lomonRow);
lomonRow = lomonth.NewRow();
lomonRow["month"] = "09";
lomonth.Rows.Add(lomonRow);
lomonRow = lomonth.NewRow();
lomonRow["month"] = "10";
lomonth.Rows.Add(lomonRow);
lomonRow = lomonth.NewRow();
lomonRow["month"] = "11";
lomonth.Rows.Add(lomonRow);
lomonRow = lomonth.NewRow();
lomonRow["month"] = "12";
lomonth.Rows.Add(lomonRow);
cboCanMonth.DataSource = lomonth;
cboCanMonth.DisplayMember = "month";
cboCanMonth.ValueMember = "month";
cboCanMonth.DropDownMember = "month";
cboRenewMonth.DataSource = lomonth;
cboRenewMonth.DisplayMember = "month";
cboRenewMonth.ValueMember = "month";
cboRenewMonth.DropDownMember = "month";
DataTable Tabyear = new DataTable();
DataRow TabyearRow;
//-- Create the table structure
Tabyear.Columns.Add("year", typeof(string));
//-- Add some rows
int length = DateTime.Now.Year + 1;
for (int i = 2005; i <= length; i++)
{
TabyearRow = Tabyear.NewRow();
TabyearRow["year"] = i.ToString();
Tabyear.Rows.Add(TabyearRow);
}
cboCanYear.DataSource = Tabyear;
cboCanYear.DisplayMember = "year";
cboCanYear.ValueMember = "year";
cboCanYear.DropDownMember = "year";
cboRenewYear.DataSource = Tabyear;
cboRenewYear.DisplayMember = "year";
cboRenewYear.ValueMember = "year";
cboRenewYear.DropDownMember = "year";
DataTable TabDoDate = new DataTable();
DataRow TabDoDateRow;
//-- Create the table structure
TabDoDate.Columns.Add("value", typeof(string));
TabDoDate.Columns.Add("display", typeof(string));
TabDoDateRow = TabDoDate.NewRow();
TabDoDateRow["value"] = "0";
TabDoDateRow["display"] = "First Day";
TabDoDate.Rows.Add(TabDoDateRow);
TabDoDateRow = TabDoDate.NewRow();
TabDoDateRow["value"] = "99";
TabDoDateRow["display"] = "Last Day";
TabDoDate.Rows.Add(TabDoDateRow);
for (int i = 1; i < 31; i++)
{
TabDoDateRow = TabDoDate.NewRow();
TabDoDateRow["value"] = i;
TabDoDateRow["display"] = i;
TabDoDate.Rows.Add(TabDoDateRow);
}
cboDOday.DataSource = TabDoDate;
cboDOday.DisplayMember = "display";
cboDOday.ValueMember = "value";
cboDOday.DropDownMember = "display";
}



 

By Robert Craill - 4/10/2011

Hi Ivan,

Dont worry found it.
TabDoDateRow["display"] = i.ToString();


The one combo field was caracter and i was try to update it with an integer.

Sorted
By Robert Craill - 4/10/2011

Nope that wasnt it.

It has to do with data in the fields.

Because it is foxpro data exported to sql the fields contain a 0 and the drop down values are 01,02 etc.

It is funny that it breaks the navigation though.