locked
toolstrip problem RRS feed

  • Question

  • Hello,

    I have a windows control that has a toolstrip. This is supposed to be a toolbar for another forms. When I'm loading the windows control I'm setting some parameters for the buttons in the toolstrip.

    Since I've added this, whenever I try to load the forms in visual studio 2008 that have this control, I'm getting Object reference not set to an instance of an object error.

    Please advice

    • Changed type Barbi Rio Tuesday, October 16, 2012 11:09 AM
    Tuesday, September 11, 2012 8:35 AM

Answers

  • there is no use. I keep saying that this is  not a solution and you keep repeating yourself. I will have to close this thread and start somewhere else. Like I can't use few ifs i don't know in mhy 11 years of programming work experience. NO MEANS NO
    • Marked as answer by Barbi Rio Tuesday, October 16, 2012 11:14 AM
    Tuesday, October 16, 2012 11:07 AM

All replies

  • Hi

    Would you like to share the code about your form in VS2008?

    I will test it in my side.


    No code, No fact.

    Thursday, September 13, 2012 1:42 AM
  • I believe that the problem is in that the toolstrip does not have Load method or something like initialize, so I have to use coltrol load method. I dont know how to run a finction when the toolstrip is loading in the form, from the code of the toolstrip
    Monday, September 24, 2012 10:30 AM
  • Hi can you post some picture of the ToolStrip controls or code, and what exact you setup ToolStrip controls to do?

    Gagi78

    Monday, October 8, 2012 7:43 PM
  • the toolstrip has buttons and it is loaded on every form
    Wednesday, October 10, 2012 7:26 AM
  • If i understand well, you have Form with ToolStrip filled with buttons which every single button open unique form, am i right? If i am, then you want to say that buttons wont work properly?

    Gagi78

    Wednesday, October 10, 2012 1:10 PM
  • No I have a lot of forms that are loading one user control and the user control contains toolstrip. Every click on the button in the toolstrip is sending a message to the parent form. The toolstrip does not have Load method so I'm using the Load method of the user contol. This is causing the forms to report an error.

    One type of the solution of my problem can be to change the toolstrip initialisation that is done in the user control load, but i don't know what event is the toolstip using to initialize itself. If there is another type of solution, I;m open to suggestions.The only thing that I can't do is initialize the toolbar in the form because there are more than 50 forms using the same user control and toolstrip

    Friday, October 12, 2012 7:11 AM
  • I dont understand, if the every button on the ToolStrip work well, what excactly you tryin to do with load metod of the ToolStrip? I thing the Load Method  is not an option. Maybe you should try Load Method on the form who use ToolStrip...

    If you have more users in that application maybe you should use a Database solution for this problem.

    Can you explain this in more detail

    "The only thing that I can't do is initialize the toolbar in the form because there are more than 50 forms using the same user control and toolstrip". ?


    Gagi78

    Friday, October 12, 2012 8:35 AM
  •  I need to implement load method of the toolstrip to enable and disable certain buttons for certain users on certain forms. Now since there is no load method for the toolstrip I am using the load method of the user control.

    using load method of the form is not an option.

     what can i possibly do with a database? when the user is logging in I read all things I need. Should I access the database when I have it all in memory? come on

    It is not that easy to access tollbar buttons in a user control (separate file to be more specific). means I have a form in 1 file, user control with toolstrip implementing toolbar in another file. The main purpose is that everything in the toolstrip should be implemented in the file of the user control, not to repeat myself 50 times in each form

    Tuesday, October 16, 2012 7:24 AM
  • Maybe you can try this:

    On Form who use that ToolStrip add a Label and connect it to the Name or ID of the user from the database you will use for that application. Then you should make some variations of IF statment like this example:

    If Name.Text = "John" Then Item1ToolStripButton.Enabled = True Item2ToolStripButton.Enabled = False ' add all buttons from the ToolStrip End If

    Or other variation is to add another Form affter User login and make specification for that user what can access in the Form with ToolStrip, again IF statments or with Database check...

    I thing the Login Form is the most very place when you should pay attention and do your Code or some Query, because that Form will deside which user can access which button.

    I hope i give you some idea.

    Regards


    Gagi78




    • Edited by Gagi78 Tuesday, October 16, 2012 11:04 AM
    Tuesday, October 16, 2012 11:00 AM
  • there is no use. I keep saying that this is  not a solution and you keep repeating yourself. I will have to close this thread and start somewhere else. Like I can't use few ifs i don't know in mhy 11 years of programming work experience. NO MEANS NO
    • Marked as answer by Barbi Rio Tuesday, October 16, 2012 11:14 AM
    Tuesday, October 16, 2012 11:07 AM