Problem with adding new record


Author
Message
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi there,

in an app I have a panel with a toolstrip (and some toolstrip-buttons), a datagridview and some textboxes.

There is a BO (called MessidentBO) and a Business Binding Source to which the BO ist bound. The BBS is used as datasource for the datagridview and the textboxes. In the cmdNew-Button I have the following code:



Me.lEditmode = True

Me.DGVWL.Enabled = False  ' Datagridview disabled

Me.cmdwlneu.Enabled = False

Me.cmdwledit.Enabled = False

Me.cmdwlsave.Enabled = True

Me.cmdwlundo.Enabled = True

Me.cmdwldelete.Enabled = False

Me.bbsmessident.BusinessObject.Add()

Me.bbsmessident.BusinessObject.Edit()

Me.TGBWL.Enabled = True  ' Themed Group Box Enabled where the textboxes reside

Me.TxtMIIdent.Focus()



But this does not work. A new record is append, but the "record pointer" (If I can use this term) is not set to the new record but stays on the one selected in the Grid.

What really makes me wondering, is that I use the same kind of code in another app and there it works fine!

I've been comparing the two pieces of code and the properties of the used elements but I can not find the difference.

Has anybody a tip for me what I might have been missing?

Thanks in advance

Thomas
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Thomas.

Is the BO the form's primary business object? Are the text controls bound to the BO?
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ivan,

yes, the textcontrols are bound to the bbs too. And in one of two cases (I have 2 panels with the

same functionality, but for different BOs) the BO is the primary BO of the form.

Best regards

Thomas
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ivan,

in an older forum-message I found the hint to refresh the grid after the add, but this does not help too.

Best regards

Thomas
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Thomas Holste (9/5/2011)
yes, the textcontrols are bound to the bbs too.


Hi Thomas.

I am a bit confused here. Have you used the textboxes Properties window to set their BusinessObject property to a BusinessBindingSource? I think that is not possible. Do you think you could write a small sample using the StrataFrameSample database reproducing what you are trying to accomplish and post it here? This way we could take a look and try to help.
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ivan,

sorry, I did not want to confuse you. The textboxes are bound by the Databindungs/Text-Property to the Business-Bindungs-Source. The problem is not with the textboxes, which are synchronized in the right way but with the BBS which does not refresh the controls (The grid and the textboxes too). When I execute the above described code, a new record is appended, but the current row does not change (In another app, which is a bit different, this code works fine). To illustrate this behaviour, I have made a little test-app which uses your database. Just click the "new"-button and see what happens.

Thanks a lot for your help

Thomas
Attachments
BBSProblem.zip (87 views, 156.00 KB)
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hey Thomas. I had a look at it and posted here with some changes that made it work. Hope it helps.

Your textboxes were not bound the StrataFrame way. You were using the (DataBindings) and not setting the BusinessObject property nor the BindingField.

In your code, I changed places where you were dealing with the BBS, and set everything to the BO. Have a look at it and see if it makes sense to you, I have commented the lines where I changed things.

Also, I would like to recommend you to go through the Tutorials in the help file in case you haven't done so yet.
Attachments
BBSProblem.zip (72 views, 101.00 KB)
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ivan,

thanks a lot for your help. I checked your changes and they work but there is something left.

What I expected (and what I did in another app is that, when I add a new record, grid and textboxes are synchronized, that means, that executing the add-code changes also to the new, still blank record in the grid. The new data is entered, after saving the grid points to the new record.

I have added to the sample a second form, which is now the start-form, which does not utilize the link-menu, the panel-manager and panels. This is the way I use it in an other app (where it works fine) and here it works now to. I changed it back to my code, but with your changes it would work the same way (Except that you use ME.Add which, like I understand ist uses the form's primary business object but I will have some panels for maintaing data from different tables).

So to me it seems that the problem is not caused by my way of binding the controls (btw:. I took from the Business Binding Sample where the grid and a corresponding label are both bound via BBS) but by the link-manager/panel-combination. You will see that everything works fine on the new form2.

Best regards

Thomas
Attachments
BBSProblem.zip (82 views, 181.00 KB)
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
What I expected (and what I did in another app is that, when I add a new record, grid and textboxes are synchronized, that means, that executing the add-code changes also to the new, still blank record in the grid. The new data is entered, after saving the grid points to the new record.


Strange, this is exactly what I got with your sample after I made the changes.

Glad you got it going!
Thomas Holste
Thomas Holste
StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)StrataFrame User (360 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ivan,

sorry to say but I haven't got it going. My sample just shows that the Business Binding Source works right if the grid which uses the BBS is not placed on a panel like it was in the first example. I tested it a little further and added now to the working example a panel-manager and a page and placed the grid and the group-box woth the textboxes on it (The sample is attached). Guess what happens? It fails. To me it looks like a seroius bug in the business binding source component? If it is a bug, will it be fixed and when? Or is this limited by design and I have to redesign the interface. I hope you understand that the thought of redesigning the interface of an almost finished app really annoys me because it is really time-consuming.

Best regards

Thomas
Attachments
BBSProblem.zip (70 views, 181.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search