Solved

class instance

Posted on 2008-10-23
2
228 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
ID: 22787991
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
ID: 22788386
Solution suggested by Bane83 will work. unless the constructor throws some exception
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

713 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