PreviewControl Close button

Hi.

I have the PreviewControl in a TabControl, and when I close the PreviewControl, I want to open/show another tab when i click the Close button, but it close the program.
Is there a way to give that Close button another comand or do i need the Pro version og the FR.NET?

Thanks for the help.

Best regards from
Ken

Comments

  • edited 11:27AM
    Hello,

    The "Close" button closes the current form. You may disable the standard Close button and add own button that does what you need:

    using DevComponents.DotNetBar;

    ButtonItem customButton = new ButtonItem();
    customButton.Text = "my button";
    customButton.Click += new EventHandler(customButton_Click);
    previewControl1.ToolBar.Items.Add(customButton);
  • edited 11:27AM
    Hi again.

    hmmmmmm...... i did not get that to work, and i am using VB.NET and DevComponents.

    I am new to VB.NET and FR [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> So if the is some diference in the programming, i will be happy for the help[/img][img]style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> Thanks for the help. Ken[/img]
  • edited 11:27AM
    Here is VB.Net equivalent:

    Imports DevComponents.DotNetBar

    Dim customButton As ButtonItem = New ButtonItem
    customButton.Text = "my button"
    AddHandler customButton.Click, AddressOf customButton_Click
    previewControl1.ToolBar.Items.Add(customButton)
  • edited 11:27AM
    Hi.

    When i did that, i got a problem with the ButtonItem that i have put i line under.
    It say that ButtonItem is ambiguous in the namspace DevComponents.DotNetBar.

    I dont have the source code, do i need that for this?
    I dont know what i am doing wrong her now, but i think i have to try something else. [img]style_emoticons/<#EMO_DIR#>/dry.gif" style="vertical-align:middle" emoid="<_<" border="0" alt="dry.gif" /> Dim customButton As[/img]ButtonItem = New ButtonItem
    customButton.Text = "my button"
    AddHandler customButton.Click, AddressOf customButton_Click
    PreviewControl1.ToolBar.Items.Add(customButton)


    Thanks for the help.


    Ken
  • edited 11:27AM
    Try
    Dim customButton As DevComponents.DotNetBar.ButtonItem = New DevComponents.DotNetBar.ButtonItem
  • edited 11:27AM
    I get the same with that to.

    And i have startet a new form, and only have the PreviewControl and DotNetBarManager there, but stil the same :-(
  • edited 11:27AM
    Please clarify: are you using DevComponents in your project? FastReport contains its own copy of DevComponents (FastReport.Bars.dll) with the same names/namespaces, so you will not be able to use both libraries at the same time (original DevComponents and the one from FastReport.Bars.dll).
    The solution is to move all reporting logic into a separate dll that uses FastReport.dll and FastReport.Bars.dll only, and reference this dll in your program. Since this dll will not use DevComponents, you will be able to do what I wrote before.
  • edited 11:27AM
    Thanks, I have seen that before about the DLL.

    Now it works grate.

    Thanks for quick respond, this is what i call good service.

    Best regards
    Ken

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.