Solved

class instance

Posted on 2008-10-23
2
219 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

839 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