Object variable or With block variable not set (Error 91) Please Help 
Author Message
 Object variable or With block variable not set (Error 91) Please Help

I have created a class with a user-defined type ChartBar:

Private Type ChartBar
  mpicBar As PictureBox
  mdtDay As Date
  msngOpen As Single
  msngHigh As Single
  msngLow As Single
  msngClose As Single
  mintVolume As Integer
  mintOpenInt As Integer
End Type

I then create an array of these ChartBars:

Private mcbTechChart() As ChartBar

I have a function later in the classthat assigns values to the
ChartBar member variables. All of the non-object variables work fine,
but when I try to set properties of the mpicBar:

mcbTechChart(ctr).mpicBar.Width = 100

I get the error 91 message -> object variable or with block variable
not set.
What am I doing wrong, or what must I do in order to set the values of
the pictureboxes?

Thanks in advance,

-Shaun



Tue, 14 Sep 2004 02:03:48 GMT  
 Object variable or With block variable not set (Error 91) Please Help

Quote:
>I have created a class with a user-defined type ChartBar:

>Private Type ChartBar
>  mpicBar As PictureBox
>  mdtDay As Date
>  msngOpen As Single
>  msngHigh As Single
>  msngLow As Single
>  msngClose As Single
>  mintVolume As Integer
>  mintOpenInt As Integer
>End Type

>I then create an array of these ChartBars:

>Private mcbTechChart() As ChartBar

>I have a function later in the classthat assigns values to the
>ChartBar member variables. All of the non-object variables work fine,
>but when I try to set properties of the mpicBar:

>mcbTechChart(ctr).mpicBar.Width = 100

>I get the error 91 message -> object variable or with block variable
>not set.
>What am I doing wrong, or what must I do in order to set the values of
>the pictureboxes?

>Thanks in advance,

>-Shaun

You'll have to do a New for PictureBox object either in the Type
declaration or when you are doing the Private.


Tue, 14 Sep 2004 03:50:56 GMT  
 Object variable or With block variable not set (Error 91) Please Help

Quote:

> I have created a class with a user-defined type ChartBar:

> Private Type ChartBar
>   mpicBar As PictureBox
>   mdtDay As Date
>   msngOpen As Single
>   msngHigh As Single
>   msngLow As Single
>   msngClose As Single
>   mintVolume As Integer
>   mintOpenInt As Integer
> End Type

> I then create an array of these ChartBars:

> Private mcbTechChart() As ChartBar

> I have a function later in the classthat assigns values to the
> ChartBar member variables. All of the non-object variables work fine,
> but when I try to set properties of the mpicBar:

> mcbTechChart(ctr).mpicBar.Width = 100

> I get the error 91 message -> object variable or with block variable
> not set.
> What am I doing wrong, or what must I do in order to set the values of
> the pictureboxes?

Are you Setting mpicBar to anything, like this?

Set mcbTechChart(ctr).mpicBar = FormX.Pictures(ctr)

Also, what's with the "Hungarian" warts?  Ever hear of Shift-F2?

--
Joe Foster <mailto:jlfoster%40znet.com>  "Regged" again? <http://www.xenu.net/>
WARNING: I cannot be held responsible for the above        They're   coming  to
because  my cats have  apparently  learned to type.        take me away, ha ha!



Tue, 14 Sep 2004 04:08:58 GMT  
 Object variable or With block variable not set (Error 91) Please Help
Well, neither of those ideas worked,

You cannot do a New to a PictureBox, and you can't do it in the
declarations anyway.

Setting the mcbTechChart(ctr) = to the picturebox() on the form does
not resolve the error either

but thanks for the help anyway, I've devised a different way of
getting doing what I need done, so it's ok.



Tue, 14 Sep 2004 12:26:55 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Object variable or With block variable not set (Error 91)

2. error 91 Object Variable o on with block variable is not set

3. Runtime error 91/Object variable or With block variable not set problems

4. runtime error: 91 Object variable or with block variable not set

5. Run Time Error 91: Object variable or With Block variable not set

6. VB 5.0 - Error:91 Object Variable Or With Block Variable Not Set

7. Object variable or With block variable not set (Error 91)

8. Error 91 Object variable or With-Block, variable not set

9. Error 91-Object or block with variable not set

10. error 91 - object or block with variable not set

11. Debugging COM+ Componets -- Runtime error 91- Object variable or with block not set

12. Error 91 - object or block width variable not set

 

 
Powered by phpBB® Forum Software