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 12
HuaMin ChenProblem resolverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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

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?
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.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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.
HuaMin ChenProblem resolverAuthor Commented:
But, to this

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

I see no values to

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

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

Open in new window

ste5anSenior DeveloperCommented:
Well, do you fill the property in you ctor?
HuaMin ChenProblem resolverAuthor Commented:
How?
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.
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
HuaMin ChenProblem resolverAuthor Commented:
I mean I cannot choose "GenText" below
https://dl.dropboxusercontent.com/u/40211031/tt292.jpg
AndyAinscowFreelance programmer / ConsultantCommented:
Please post your class declaration - because you state you have coded the Gentext property.
HuaMin ChenProblem resolverAuthor Commented:
I did declare property as shown in above.
AndyAinscowFreelance programmer / ConsultantCommented:
Please show the compiler error when you have something like
dim b as Boolean
b = ds.GenText
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

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

Just checking you accepted the right answer?
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.
HuaMin ChenProblem resolverAuthor Commented:
Yes, Julian
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.