Solved

class instance

Posted on 2008-10-23
2
194 Views
Last Modified: 2012-05-05
hello experts

i wanted to set the instance of this customerdetailclass based on learnit value
i tried the following and am getting errors

 If learnIt Then
    Dim ContactDetails As New CustomerDetailsClass(ContactTitle, txtContactFirstName.Text,,,,,,)
 else
    Dim ContactDetails As New CustomerDetailsClass(ContactTitle, txtContactFirstName.Text,,,,,,)
 end if

 Can I not use like this?

 Dim ContactDetails As New CustomerDetailsClass
 if learnt then
  ContactDetails = ContactDetails(ContactTitle, txtContactFirstName.Text,,,,)
 else
  ContactDetails = ContactDetails(ContactTitle, txtContactFirstName.Text,,,,)
end if

please advise
thanks
 
 
0
Comment
Question by:learningnet
2 Comments
 
LVL 10

Accepted Solution

by:
Bane83 earned 400 total points
Comment Utility
Try this:

Dim ContactDetails As CustomerDetailsClass ' (if this doesn't work, try Object instead of CustomerDetailsClass here)
 if learnt then
  ContactDetails = New CustomerDetailsClass(ContactTitle, txtContactFirstName.Text,,,,)
 else
  ContactDetails = New CustomerDetailsClass(ContactTitle, txtContactFirstName.Text,,,,)
end if
0
 
LVL 13

Assisted Solution

by:TechTiger007
TechTiger007 earned 100 total points
Comment Utility
Solution suggested by Bane83 will work. unless the constructor throws some exception
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now