ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Error occurs in VB.NET Winform after imports ChartDirector
Posted by cici on May-13-2015 00:02
Hi Peter,

I am struggling to solve this problem. This following problem is happened:

  1)      Dim Z(12) As Double

  2)      Dim zstring(12) As String
  3)      For i = 1 To 13
  4)         zstring(i - 1) = "Zone" & (i) & "_Thick"
  5)     Next

  6)      For i = 1 To 13
  7)         Z(i - 1) = CType(Me.Controls(zstring(i - 1)), TextBox).Text
  9)      Next

There is a error massage " Value of type 'System.Windows.Forms.Control' cannot be
converted to 'ChartDirector.TextBox'. " on line #7

After I commented out "Imports ChartDirector", this error is disappeared.

Please help me !

Thank you

cici

  Re: Error occurs in VB.NET Winform after imports ChartDirector
Posted by Peter Kwan on May-13-2015 00:59
Hi cici,

There are two types of TextBox in your code, one is System.Windows.Forms.TextBox and
the other is ChartDirector.TextBox. Since your code do not specify which TextBox it means,
and your code Imports ChatDirector, so the VB compiler randomly thinks your code must
mean ChartDirector.TextBox. But ChartDirector.TextBox is not a subclass of
"System.Windows.Forms.Control", so the conversion failed.

To solve the problem, please specify what type of TextBox you mean. Use
System.Windows.Forms.TextBox, not just TextBox.

Hope this can help.

Regards
Peter Kwan

  Re: Error occurs in VB.NET Winform after imports ChartDirector
Posted by cici on May-13-2015 02:30
Thank you Peter!

You are awesome!

cici