StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



a simple comboboxExpand / Collapse
Author
Message
Posted 06/19/2008 10:49:07 AM


StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 08/12/2008 8:55:55 AM
Posts: 31, Visits: 67
Hi ,

Im a french new user of strataframe, so excuse my language fault.

My problem.

I have a form with to businessobject.

The first is  ActeursBO

 It contain a table "acteurs" with  identifiant    int     identity and primary key

                                                 name        char(30)

                                                 firstname   char(10)

                                                 titre_id     int

The  data are

    IDENTIFIANT                     NAME                     FIRSTNAME                 TITRE_ID

                   1                        LEISSLER                ERIC                             3

                   2                        LEISSLER                COLETTE                        2

                   3                        LEISSLER                SEREINE                        1

THE second businnes object is

TITREBO

It contain  table   "titre" with   identifiant   int  identity   primarykey

                                             abrege            char(10)

                                             libelle             char(30)

and the data is

IDENTIFIANT               ABREGE                  LIBELLE

        1                          Melle                      Mademoiselle

        2                           Mme                      Madame

        3                           M.                          Monsieur

So in my form i have  acteursBO1  and  TitresBO1

in the property of titresbo1 i have  ParentbusinnesObject  = ActeursBo1

So i drop a  strataframe combobox in my form

on property  i go to Businnesobject and i select Acteursbo1

In bindingfields i select titre_id

in the property Plulatiopndatasourcesettings  i select in busines obect type titresbo

in display member i select abrege and in value number i select identifiant

When i execute i have an error  at the line

ctype(component,acteursbo).titre_id = ctupe(value,system.int32)

the error is the conversion of type  dbnull  in type integer is not valid

What can i do ?

what i have not do ?

what i have to do  ?

i don't find in the example à simple exemple with a simple combobox.

Somebody  can  send an  sample example like this problem ?

I will thank you for the time  you pass'd to read this post

Best regard

Eric LEISSLER

Post #17176
Posted 06/19/2008 11:07:38 AM
Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 9:25:14 PM
Posts: 700, Visits: 2,905
Hi Eric and welcome to the forums.

So in my form i have  acteursBO1  and  TitresBO1

in the property of titresbo1 i have  ParentbusinnesObject  = ActeursBo1

So i drop a  strataframe combobox in my form

on property  i go to Businnesobject and i select Acteursbo1

In bindingfields i select titre_id

in the property Plulatiopndatasourcesettings  i select in busines obect type titresbo

in display member i select abrege and in value number i select identifiant

When i execute i have an error  at the line

ctype(component,acteursbo).titre_id = ctupe(value,system.int32)

the error is the conversion of type  dbnull  in type integer is not valid

Here are some things I see in your code:

  • You don't need to have the TitresBO1 in the form, since the combobox class will use an internal BO to show the lookup data and there will be no need to update the ParentBusinessObject since this BO is not needed in the form.
  • In the TitresBO.vb class, modify the code and add a method that will return you all the records for that table and use that method in your ComboBox.PopulationDataSourceSettings property.  Here is an example of what I use in these cases:

#Region " Data Retrieval Methods "

     ''' <summary>

     ''' This method will return all records from the table InsuredCorporation

     ''' </summary>

     ''' <remarks></remarks>

     Public Sub FillAllRecords()

          Using cmd As New SqlCommand()

               cmd.CommandText = String.Format("Select * From {0} ORDER BY CorporationName", Me.TableName)

               Me.FillDataTable(cmd)

          End Using

     End Sub

#End Region

  • Recompile your TitresBO.vb class so you can see the new method FillAllRecords in the designer Properties windows.
  • Now modify your ComboBox.PopulationDataSourceSettings property to use the new method TitresBO.FillAllRecords().

Here is a picture of the ComboBox properties:

Now, Save, Rebuild and Test....

Good luck!

 
Post #17179
Posted 06/19/2008 11:24:02 AM


StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 08/12/2008 8:55:55 AM
Posts: 31, Visits: 67
Hi Edhy

Its really great  !

Thanks you very much

I made this changement and its ok  now .

I can continue my learning of strataframe.

Great thanks

Best regards

Eric

Post #17180
Posted 06/19/2008 11:32:12 AM
Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 9:25:14 PM
Posts: 700, Visits: 2,905
Hi Eric,

I am glad it worked for you.

Also the forum's search feature is pretty good and you can do searches to find specific topics which may give you an answer quickly.  Since I am also learning SF, I use the forums all the time and they are a great, great resouces.

 
Post #17181
Posted 06/19/2008 1:26:35 PM


StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 08/12/2008 8:55:55 AM
Posts: 31, Visits: 67
Thank you tremeThank you tremendously anyway, because it allows me to advancendously anyway, because it allows me to advance

best regards

Eric

Post #17191
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 5:29am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.078. 13 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.