dcsimg
Results 1 to 15 of 15

Thread: Which data type is Microsoft StatusBar Control 6.0?

  1. #1

    Thread Starter
    Lively Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, Macedonia
    Posts
    120

    Which data type is Microsoft StatusBar Control 6.0?

    I have a procedure which accepts status bar as a parameter. I send a reference to my procedure to this status bar control. However it complains it cannot find the type: System.Windows.Forms.Control

    Code:
    Public Sub RunTests(ByRef myarray() As Boolean, ByRef stb As TextBox, ByRef stbControl As System.Windows.Forms.Control)
    ' your code here
    ' otuput messages to status bar control
    End Sub
    I am using a text box now as a status bar, but Microsoft StatusBar Control 6.0 is more powerful.

    How can I send ActiveX Control aka Microsoft StatusBar Control 6.0 to my procedure as parameter?
    Which type it is?

    What should I import in my Access 2000 VBA class?

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,753

    Re: Which data type is Microsoft StatusBar Control 6.0?

    Does this question have anything to do with VB.NET at all? Are you saying that you have VBA code that currently works for a .NET control and you want to adapt it for this ActiveX control?

  3. #3
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    1,870

    Re: Which data type is Microsoft StatusBar Control 6.0?

    If it's VBA shouldn't that be something like "MSForms.Control" or something?
    One System to rule them all, One IDE to find them,
    One Code to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  4. #4

    Thread Starter
    Lively Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, Macedonia
    Posts
    120

    Re: Which data type is Microsoft StatusBar Control 6.0?

    No, its not VB.NET. I used ActiveX Control Microsoft StatusBar Control 6.0 which was in the ActiveX list in the toolbox in Access 2000.

    I wasn't aware it is related to .NET. Is it really?

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,446

    Re: Which data type is Microsoft StatusBar Control 6.0?

    what code do you have that is relevant to the status bar control?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  6. #6
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,753

    Re: Which data type is Microsoft StatusBar Control 6.0?

    Quote Originally Posted by kutlesh View Post
    I wasn't aware it is related to .NET. Is it really?
    I asked because you specified that you used System.Windows.Forms.Control, which is specifically a .NET type. If this has nothing to do with .NET then using .NET types won't help.

  7. #7

    Thread Starter
    Lively Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, Macedonia
    Posts
    120

    Re: Which data type is Microsoft StatusBar Control 6.0?

    I want to display messages when a command finished executing or when error happens in a status bar.

    I also tried MSComctlLib.statusBar which also gives error "type mismatch".

    How can I use MSForms.Control? What do I import?

  8. #8
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,446

    Re: Which data type is Microsoft StatusBar Control 6.0?

    msforms controls does not include the status bar control, which you have already found

    you have to actually insert the control object onto a window or form, have you done that?

    what code are you using for the statusbar?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  9. #9

    Thread Starter
    Lively Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, Macedonia
    Posts
    120

    Re: Which data type is Microsoft StatusBar Control 6.0?

    Yes I have inserted a status bar object on my form and gave it a name. I now tried this:

    Code:
    Public Sub RunTests(ByRef myarray() As Boolean, ByRef stb As TextBox, ByRef stbControl As MSComctlLib.statusBar)
    ' code here
    End Sub
    Then in my form I use this:

    Code:
    Dim runTestsObj As New SQL_Module_Tests
    runTestsObj.RunTests sqlChecks, statusBar, statusBarControl
    Still error "type mismatch"!

    Hmm, am I doing something wrong? Am I using the right component?

    Name:  statusBarControl.PNG
Views: 239
Size:  10.8 KB

  10. #10
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    1,870

    Re: Which data type is Microsoft StatusBar Control 6.0?

    Well there is always the way using "As Object".....
    One System to rule them all, One IDE to find them,
    One Code to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  11. #11
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,446

    Re: Which data type is Microsoft StatusBar Control 6.0?

    runTestsObj.RunTests sqlChecks, statusBar, statusBarControl
    you should pass the control by name, unless you changed the control name to statusBarControl, the default name would be statusbar1

    also in vba the controls are not necessarily public in scope, at the least they would have to be fully qualified
    so if the code above is not in the module of the same object, that contains the control, then you could have an issue
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  12. #12

    Thread Starter
    Lively Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, Macedonia
    Posts
    120

    Re: Which data type is Microsoft StatusBar Control 6.0?

    Yes "statusBarControl" is the name of the component Microsoft StatusBar Control 6.0 which I have on my form.

    Hmm I see statusBarControl field when I get the autocomplete list of available functions/components/procedures in the current form context.

    Should it be Global? How can I set my component Global?
    Last edited by kutlesh; Jun 25th, 2018 at 06:27 AM.

  13. #13
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,446

    Re: Which data type is Microsoft StatusBar Control 6.0?

    then it should work, what code are you using to change the property of the statusbar?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  14. #14

    Thread Starter
    Lively Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, Macedonia
    Posts
    120

    Re: Which data type is Microsoft StatusBar Control 6.0?

    i found that you can set many panels inside the property called "custom". You can also display an image inside a status bar panel.

    Here is a sample of my code:

    Code:
    statusBarControl.Panels(1).Text = "My Message"
    Panels are indexed with 1, 2, 3, etc... so this:

    Code:
    statusBarControl.Panels(3).Text = "My Message3 "
    should also work if you add 3 panels.

    But I tried with
    Code:
    ByRef stbControl as Object
    and it works now
    Last edited by kutlesh; Jun 25th, 2018 at 06:43 AM.

  15. #15
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    1,870

    Re: Which data type is Microsoft StatusBar Control 6.0?

    hu?

    I just did a test in Excel-VBA.
    Fresh VBA-Project in Excel, add UserForm, add Standard module, add Reference to StatusBar 6.0, slap StatusBar and CommandButton on UserForm
    Code:
    'In a Standard module
    Sub MyProc(ByRef stbTest As MSComctlLib.StatusBar)
    stbTest.Panels(1).Text = "Test"
    End Sub
    
    
    'on Form1
    Private Sub CommandButton1_Click()
    MyProc StatusBar1
    End Sub
    One System to rule them all, One IDE to find them,
    One Code to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width