Error when use GUID field as browse search field


Author
Message
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I hit error below if I set a GUID field as browse search field. This search field is also set to use combobox - Business Object.

Please advice.

Thank you

InvalidOperationException
 The input value could not be converted to the output type.
FormatException
 Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

Source     : MicroFour StrataFrame Base

Stack Trace:
   at System.Guid..ctor(String g)
   at MicroFour.StrataFrame.Data.ObjectConverter.ConvertValue(Object InputValue, Type InputType, Type OutputType, String FormatString)
   at MicroFour.StrataFrame.Data.ObjectConverter.ConvertValue(Object InputValue, Type OutputType)
   at MicroFour.StrataFrame.UI.Windows.Forms.ListControl.PopulateComboFromBusinessObject(IListControl lstControl, Object[] Parameters)
   at MicroFour.StrataFrame.UI.Windows.Forms.ListControl.PopulateCombo(Control lstControl, Object[] Parameters)
   at MicroFour.StrataFrame.UI.Windows.Forms.ComboBox.PopulateCombo(Object[] Parameters)
   at MicroFour.StrataFrame.UI.Windows.Forms.ComboBox.Requery()
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogWindow.CreateBOCombo(SearchFieldItem Item)
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogWindow.CreateAllSearchFieldControls()
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogWindow.AddSearchFields()
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogWindow..ctor(BrowseDialog BrowseDialogSettings, Boolean PopulateOnShow)
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog.ShowDialog(Boolean PopulateOnShow)
   at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog.ShowDialog()
   at MicroFour.StrataFrame.UI.Windows.Forms.MaintenanceFormToolStrip.cmdBrowse_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Do you have a valid selection within the combo box?  The SelectedValue of the combo box will have to be GUID value...
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I have retest this issue. I found that, after I set combo - Business Object, code is generated to designer.cs.

However, if I try to reconfigure the same search field, the UI unable to get my Business Object, and show blank in business object type, method to execute and display field.

Any ideas? I can use the same BO in data entry form without any problem.

Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

After some debugging, I found this.

At the line of code shown below, value of

.TopMostItem.TopMostValue = "-1"
loBO.GetPropertyDescriptor(.PopulationDataSourceSettings.ValueMember).PropertyType = {Name = "Guid" FullName = "System.Guid"} System.Type

When SF.NET try to convertvalue, "-1" cant be converted to GUID. Does lstControl..TopMostItem.TopMostValue always been defaulted to "-1"? Can it be changed?

Private Shared Sub PopulateComboFromBusinessObject(ByVal lstControl As IListControl, ByVal Parameters As Object())
...
loNewRow.Item(VALUE) = MicroFour.StrataFrame.Data.ObjectConverter.ConvertValue(.TopMostItem.TopMostValue, loBO.GetPropertyDescriptor(.PopulationDataSourceSettings.ValueMember).PropertyType)

 


Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I just found this code may cause the problem

Private Function CreateBOCombo(ByVal Item As SearchFieldItem) As Control
...
.TopMostItem = New TopMostListItem(_BrowseDialog.EnumTopMostText, "-1")

How to fix it?

Thank you


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Just select the combo box, right-click the TopMostItem property, and then click Reset.  This will remove the top most item settings within your designer.
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

The combobox is in browse dialog form. How to reset its the combobox property? I was thinking all search fields are generated only during runtime.

Please advice.

Thank you

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Are you wondering how to repopulate the combobox with fresh values?  The combo box is built at runtime whenever the browse dialog is displayed, so shouldn't need to repopulate it because it will contain the fresh values each time the dialog is shown.
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
No, I don't meant that.

OK, I have a field called VendorID which is GUID field type.

I add this field as browse dialog search field, ComboBox - business object (VendorsBO.FillAll()). I would hit error when I click on browse button.

InvalidOperationException
 The input value could not be converted to the output type.
FormatException
 Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

After some debugging, I found that, TopMostItem.TopMostValue is always defaulted as "-1" when combobox is created (as shown as below). When program try to convert TopMostValue to GUID, it hit error.

Private Function CreateBOCombo(ByVal Item As SearchFieldItem) As Control
...
.TopMostItem = New TopMostListItem(_BrowseDialog.EnumTopMostText, "-1")

Do you get what I meant?

Please advice

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Change the "-1" to "{00000000-0000-0000-0000-000000000000}" and give it a try.  I have not tested this, but a -1 cannot be converted to a GUID.
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