Hello everybody,


I'm trying to achieve the following :

I have a class (bussiness layer) where I want to create a combobox in
runtime.

Public class MyClass
Private _cbo as new combobox
Public readonly property Cbo as combobox
Get
return _cbo
End get
end property

sub new
FillCombo
end sub

private sub FillCombo
... Fill my combo here ...
end sub
End Class

So I create a combobox in a seperate class.

Right now I have on my form an existing combobox called MyCombo

In my form Load I want to do the following :

Dim oMyObject as New MyClass

MyCombo = oMyObject.Cbo

So that everything's passed to my existing combo. This works fine .... only
one thing.. I don't see the values in my combobox. If I look in debugging
mode to the existing combo, then every value is passed to it (from the
class).

The only thing I can't achieve is that it all the values are showed in my
exisitng combo.

I hope someone could help me out !

Thx in advance !

Bjorn

Re: Problem with combobox filled in class by hirf-spam-me-here

hirf-spam-me-here
Tue Dec 16 11:23:05 CST 2003

* "Bjorn De Waele" <bjorn@pondlibrary.NOSPAMorg> scripsit:
> I'm trying to achieve the following :
>
> I have a class (bussiness layer) where I want to create a combobox in
> runtime.

That's IMO bad design...

>
> Public class MyClass
> Private _cbo as new combobox
> Public readonly property Cbo as combobox
> Get
> return _cbo
> End get
> end property
>
> sub new
> FillCombo
> end sub
>
> private sub FillCombo
> ... Fill my combo here ...
> end sub
> End Class
>
> So I create a combobox in a seperate class.
>
> Right now I have on my form an existing combobox called MyCombo
>
> In my form Load I want to do the following :
>
> Dim oMyObject as New MyClass
>
> MyCombo = oMyObject.Cbo

Are you sure you undertood what 'As New' does? It will create a /new/
instance of a class/structure. 'MyClass' is a reserved keyword in
VB.NET.

> So that everything's passed to my existing combo. This works fine .... only
> one thing.. I don't see the values in my combobox. If I look in debugging
> mode to the existing combo, then every value is passed to it (from the
> class).

Why not create the combobox directly in the presentation layer? Or you
can pass the combobox to the BL and let him fill it.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Re: Problem with combobox filled in class by Bjorn

Bjorn
Tue Dec 16 14:36:58 CST 2003


Hi Herfried,

That MyClass was just an example. I choose a bad word for it :)

I just wanted to create the combobox in my Bussiness Layer cause it's a lot
easier to implement it after it in my presentation.

But if it's bad design then I won't to do this ! Anyway, do you think it
should be possible ?

Thanks a lot,

Bjorn


"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:brnf93$4r2p2$1@ID-208219.news.uni-berlin.de...
> * "Bjorn De Waele" <bjorn@pondlibrary.NOSPAMorg> scripsit:
> > I'm trying to achieve the following :
> >
> > I have a class (bussiness layer) where I want to create a combobox in
> > runtime.
>
> That's IMO bad design...
>
> >
> > Public class MyClass
> > Private _cbo as new combobox
> > Public readonly property Cbo as combobox
> > Get
> > return _cbo
> > End get
> > end property
> >
> > sub new
> > FillCombo
> > end sub
> >
> > private sub FillCombo
> > ... Fill my combo here ...
> > end sub
> > End Class
> >
> > So I create a combobox in a seperate class.
> >
> > Right now I have on my form an existing combobox called MyCombo
> >
> > In my form Load I want to do the following :
> >
> > Dim oMyObject as New MyClass
> >
> > MyCombo = oMyObject.Cbo
>
> Are you sure you undertood what 'As New' does? It will create a /new/
> instance of a class/structure. 'MyClass' is a reserved keyword in
> VB.NET.
>
> > So that everything's passed to my existing combo. This works fine ....
only
> > one thing.. I don't see the values in my combobox. If I look in
debugging
> > mode to the existing combo, then every value is passed to it (from the
> > class).
>
> Why not create the combobox directly in the presentation layer? Or you
> can pass the combobox to the BL and let him fill it.
>
> --
> Herfried K. Wagner [MVP]
> <http://www.mvps.org/dotnet>



Re: Problem with combobox filled in class by hirf-spam-me-here

hirf-spam-me-here
Tue Dec 16 15:49:19 CST 2003

* "Bjorn De Waele" <bjornNOSPAMKIT@pondlibrary.org> scripsit:
> That MyClass was just an example. I choose a bad word for it :)
>
> I just wanted to create the combobox in my Bussiness Layer cause it's a lot
> easier to implement it after it in my presentation.
>
> But if it's bad design then I won't to do this ! Anyway, do you think it
> should be possible ?

It whould be possible, but then you will have to add the control created
in the BL to the form.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>