Set value

Hi,
I define property below

Public Class ExportInterComSalesDataToSunAccountDataSource
    Inherits ExportDataToSunAccountDataSourceBase

    Private _GenText As Boolean
    Public Property GenText As Boolean
        Get
            Return _GenText
        End Get
        Set(value As Boolean)
            _GenText = value
        End Set
    End Property

Open in new window

to the class. when referencing the class, how to set the value of the property to one specific value, and also to Get its value?
LVL 11
HuaMin ChenProblem resolverAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
>>when referencing the class, how to set the value of the property to one specific value, and also to Get its value?

to set a value
ob.GenText = True   'ob is a ExportInterComSalesDataToSunAccountDataSource variable

and get a value
bFlag = ob.GenText  'ob is a ExportInterComSalesDataToSunAccountDataSource variable, bFlag is boolean
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HuaMin ChenProblem resolverAuthor Commented:
what is the value of "ob" in my case?
0
Julian HansenCommented:
Dim ob as new ExportInterComSalesDataToSunAccountDataSource()
ob.GenText = true

Open in new window

ob is an instance of the class ExportInterComSalesDataToSunAccountDataSource. The class definition is just a definition - it describes the class. To use it you first have to instantiate (create an instance of) it using the new operator.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

ste5anSenior DeveloperCommented:
Just a comment:

You class names indicate a too tight coupling of different concerns/aspects. Source and destination of your export process should be parameters, specified at runtime.
0
HuaMin ChenProblem resolverAuthor Commented:
But, to this

           ds = New ExportInterComSalesDataToSunAccountDataSource(OptionForm, {GA_DBNAME, SM_DBNAME}, conn)

I see no values to

ds.GenText
0
HuaMin ChenProblem resolverAuthor Commented:
Julian,
I mean no "GenText" is available to ds.
0
HuaMin ChenProblem resolverAuthor Commented:
Right after the declaration of this line

ds = New ExportInterComSalesDataToSunAccountDataSource(OptionForm, {GA_DBNAME, SM_DBNAME}, conn)

Open in new window

0
ste5anSenior DeveloperCommented:
Well, do you fill the property in you ctor?
0
HuaMin ChenProblem resolverAuthor Commented:
How?
0
AndyAinscowFreelance programmer / ConsultantCommented:
>>what is the value of "ob" in my case?

Just what I said it was:  ob is a ExportInterComSalesDataToSunAccountDataSource variable

>>ds = New ExportInterComSalesDataToSunAccountDataSource(OptionForm, {GA_DBNAME, SM_DBNAME}, conn)
I see no values to
ds.GenText


ds.GenText should have a value as long as ds is not null.  Note you should set the value in the constructor you call, it looks like you want to fill in some values from a database.
0
AndyAinscowFreelance programmer / ConsultantCommented:
>>I mean no "GenText" is available to ds.

Should you mean the compiler shows an error then just what is your code because in your question you have:
Public Class ExportInterComSalesDataToSunAccountDataSource
    Inherits ExportDataToSunAccountDataSourceBase

    Private _GenText As Boolean
    Public Property GenText As Boolean
        Get
            Return _GenText
        End Get
        Set(value As Boolean)
            _GenText = value
        End Set
    End Property

Open in new window

which does declare that property
0
HuaMin ChenProblem resolverAuthor Commented:
I mean I cannot choose "GenText" below
https://dl.dropboxusercontent.com/u/40211031/tt292.jpg
0
AndyAinscowFreelance programmer / ConsultantCommented:
Please post your class declaration - because you state you have coded the Gentext property.
0
HuaMin ChenProblem resolverAuthor Commented:
I did declare property as shown in above.
0
AndyAinscowFreelance programmer / ConsultantCommented:
Please show the compiler error when you have something like
dim b as Boolean
b = ds.GenText
0
HuaMin ChenProblem resolverAuthor Commented:
Error is

Error	4	'GenText' is not a member of 'ToolbarLibrary.ExportDataToSunAccountDataSourceBase'.	

Open in new window

due to 2nd line below

            Dim b As Boolean
            b = ds.GenText
			...

Open in new window

0
AndyAinscowFreelance programmer / ConsultantCommented:
Please use the correct class, ds should be of ExportInterComSalesDataToSunAccountDataSource, NOT of this class: ExportDataToSunAccountDataSourceBase
0
HuaMin ChenProblem resolverAuthor Commented:
I did declare ds as "ExportInterComSalesDataToSunAccountDataSource" in above.
0
Julian HansenCommented:
@HuaMinChen,

Just checking you accepted the right answer?
0
AndyAinscowFreelance programmer / ConsultantCommented:
>>I did declare ds as "ExportInterComSalesDataToSunAccountDataSource" in above.
??

Not according to the error message you posted.  You need to use the property as I instructed in the very first post.
0
HuaMin ChenProblem resolverAuthor Commented:
Yes, Julian
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.