By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,640 Members | 1,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,640 IT Pros & Developers. It's quick & easy.

User Control and DB

P: n/a
I have a panel and some userControls.
To load them to my Panel :

Dim monFormulaire As New UcFormulaireTest
panelFormulaire.Controls.Clear()
panelFormulaire.Controls.Add(monFormulaire)
But if i have a query who search the name of my UC :
like :
Dim monFormulaire As New cmd.executeScalar !!!! HERE IS MY PROBLEM
panelFormulaire.Controls.Clear()
panelFormulaire.Controls.Add(monFormulaire)

thx for help

Nov 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Hi,
Dim monFormulaire As New cmd.executeScalar !!!! HERE IS MY PROBLEM


Have you any idea why this should work.

With this you tell that monFormulaire is a field in the correct format in a
database.
There is no usercontrol field at least in a SQLServer or MSAccess database.

Cor
Nov 21 '05 #2

P: n/a
Yes i know it... but i don't know how to convert to my type...

i try ctype... but i have not success

Nov 21 '05 #3

P: n/a
Usecasessoftware

Do you mean you want to do something in a kind of pseudo code

\\\
dim indexer as integer
"select indexer from database"
indexer = executescalar

select case indexer
case 1
pannel.add(usercontrol1)
case 2
pannel.add(usercontrol2)
end select
///

I hope this helps,

Cor

"ucasesoftware" <uc***********@hotmail.fr> schreef in bericht
news:11**********************@o13g2000cwo.googlegr oups.com...
Yes i know it... but i don't know how to convert to my type...

i try ctype... but i have not success

Nov 21 '05 #4

P: n/a
it's what i did but i want direc

dim myUC as new indexer

understand ?

Nov 21 '05 #5

P: n/a
Unesec

dim myUC as new indexer


This command telss that there should be created a new object myUC from the
type indexer.

What is the sense of that?

Cor
Nov 21 '05 #6

P: n/a
no no
i have a userControl name : test.vb

in database i have a column : nameOfUserControl
with my cmd.executeScalar i read the column nameOfUserControl

so i want to do :

Dim monFormulaire As New cmd.executeScalar (who is "test")

Nov 21 '05 #7

P: n/a
myApplication have to take message from phone
But if its doctor message i have to display doctor UC and if it's
customers message i have to display curtomer message

So i have several UC and one message winform

but i can have 100 UC...
So ok i can do Select Case ....

but if i can do directry .... dim myUC as new " cmd.excecuteScalar"

it's more clean code...

that's all... but maybe it's impossible

Nov 21 '05 #8

P: n/a
ucase,

A control is not serializable, so you cannot place it in a database.
What you can do is giving it an ident.

Than you can find it direct in the method as I gave you, what is early
binding and which goes fast at runtime or using it indirect using reflection
(late binding).

For both you have to build an error routine in your program for if somebody
outside the program changes the database.

That reflection method is less work to type with 100 controls, however I
don't like it, with some copy and paste and simple indexnames that select is
as well very quick build.

Beneath a link to a sample. There are more samples in this newgroup about
using reflection with this. However you can maybe start with this one.

http://groups.google.com/group/micro...53a4b7e?hl=en&

I hope this helps,

Cor

"ucasesoftware" <uc***********@hotmail.fr> schreef in bericht
news:11**********************@g43g2000cwa.googlegr oups.com...
myApplication have to take message from phone
But if its doctor message i have to display doctor UC and if it's
customers message i have to display curtomer message

So i have several UC and one message winform

but i can have 100 UC...
So ok i can do Select Case ....

but if i can do directry .... dim myUC as new " cmd.excecuteScalar"

it's more clean code...

that's all... but maybe it's impossible

Nov 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.