473,396 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using MsChart

I have a program that I have added a tab control (using to following code)
with 12 tabpages, on the pages
I added AxMsChart and a Button. The button control works
fine but the AxMsChart gives an "InvalidActiveXstateException" error when
I try to add a title as ".Title.Text = "Sales". What I am I doing wrong ?

I have attached the following code:

Private Sub InitializeTabs()
Dim i As Short
Dim myMonth(24) As String
Dim monthIdx As Short
For i = 1 To 12
If myMonth(i) = pTabLayOut Then
monthIdx = i
End If
Next
Dim idx As Short = monthIdx

For i = 0 To 13
Dim myTabPage As New TabPage
Dim myMSChart As New AxMSChart
Me.TabControl1.Controls.AddRange(New Control() {myTabPage})

If i = 0 Then
Me.TabControl1.TabPages(i).Text = "MISC."
ElseIf i = 13 Then
Me.TabControl1.TabPages(i).Text = " SUM"
Else
Me.TabControl1.TabPages(i).Text = " " & myMonth(idx)
Me.TabControl1.TabPages(i).Controls.Add(New AxMSChart)
Me.TabControl1.TabPages(i).Controls.Add(New Button)
End If

idx = idx + 1
Next i

Me.TabControl1.Location = New Point(115, 10)
Me.TabControl1.Size = New Size(680, 350)

Me.ClientSize = New Size(800, 400)
End sub
Private Sub CreateCollections()
'This code will dynamically include all AxMSChart in the
'a collection at runtime.
Dim c As Control
Dim c2 As Control
Dim c3 As Control

For Each c In Me.Controls 'look
at intire form
If c.GetType() Is GetType(TabControl) Then 'find a
tabControl
For Each c2 In c.Controls
'look at all controls on tabControl
If c2.GetType() Is GetType(TabPage) Then 'find a
tabPage
For Each c3 In c2.Controls 'look
at all controls on a tabPage
If c3.GetType() Is GetType(AxMSChart) Then
'find a AxMSChart
pChartCollection.Add(c3) 'add
AxMSChart to collection
End If
If c3.GetType() Is GetType(Button) Then 'find
a listBox
pButtonCollection.Add(c3) 'add
listBox to collection
End If
Next
End If
Next
End If
Next

End Sub

This is where I receive an error.

pChartCollection(1).Title.Text = "Sales"
Nov 21 '05 #1
1 1797
Tom,

You have two times called that .Title.Text = "Sales" gives an error, however
I don't see it in your code.

Maybe for the next time, I find the way that you show us the problem not
inviting to help.
Telling that an instruction with a dot from a with goes wrong, needs to
search for that instruction. while maybe a full instruction can be helped
direct.

Cor
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: gu | last post by:
I have a rather stupid problem with the mschart 6 component. It always sips one row in the source it's surposed to display. For example, if a SQL statement that defines the recordset object returns...
0
by: Gerhard Swart | last post by:
Good Morning, I have a licensed .Net product. Meaning I can develop and deploy my projects. I want to use MSChart in my latest project. Now I am not sure about the licensing of MSChart. As far...
1
by: Jaime Lucci | last post by:
Has anybody any documentation about MSChart? Thanks.
1
by: perspolis | last post by:
Hi all I want to print content of a MsChart.. I think I can do that by getting an image from that.. How can I do that?or is there any better way to print MsChart? thanks in advance
2
by: John Blair | last post by:
Hi, In my webform HTML i have the following code, but i cannot view and configure this chart control in the code behind class. In the code behind class i have a reference to this com control...
2
by: andrew | last post by:
I have an application that requires graphical output. I have added a MSChart to the application and want to be able to print this out. I have a form which allows me to print, and zoom in etc for...
0
by: JS | last post by:
Hello I want translate a project from VB6 to VB.Net 1.0 In this project I have a graph with a MsChart COM control. When I want make reference (Projet/Ref /Com controle) to this chart I have an...
0
debasisdas
by: debasisdas | last post by:
Here's a simple VB6 code snippet that uses the MSChart control to display Charts in VB6.0. To use this sample, please following steps Create a new project in VB6 Pull down the Project menu and...
2
by: Just_a_fan | last post by:
I was working with MSChart, modifying one of the graphs and decided I wanted this particular chart to have an auto scale. I worked quite a while with it, uttered a few obscenities directed at the...
0
by: Just_a_fan | last post by:
Some folks have searched, from time to time, for a dual axis MSChart with different scales on the two Y axes. The sample, extracted from running code I wrote, produces a graph with MSChart (VB9)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.