Many a C# Question

Hi,

I've got a few questions relating to C# (Forms & Code) and am hoping that someone could please help. If you do, it'll be much appreciated.

  1. Is it possible to add tabs (like MS VS does) when I want to make a new thing If so, what do I do
  2. Is is possible, to add non-existant programs to a menu after they have been installed on a computer (like MS Windows Start Menu etc. or Internet Explorer) If so, what do I do
  3. When printing with web browsers, is it possible to NOT use the image document user (like when using IE) If so, what do I do
  4. Is it posssible to ban websites using web browsers If so, what do I do
  5. Is it possible to have a loading bar when a web browser is loading or if something is printing If so, what do I do
  6. Is it possible to have a <Back and Forward> button like in IE and Windows Explorer If so, what do I do
  7. Is it possible to have text size & encoding in web browser menus If so, what do I do

These questions were gathered over a period of time so that only one forum post would be used and so I don't have too many posts all over the place.

Thanks,

Eragon.




Answer this question

Many a C# Question

  • praveench2k

    I'm talking about the main as you write and that is first question of first post. You are searching for tab control that behaves like Visual Studio (VS) works with open documents windows.

  • HeatherLK

    To answer question four i would recomend you do :

    Form1.Dispose();

    Otherwise

    this.ShowInTaskbar = false;
    Form1.Hide();


  • yudkovsky

    Hi,

    I have gathered pleanty of more questions and am going to publush them here instead of putting them in another post, due to space and time:

    1. Is it possible to generate a password after the application looks at the processor's id Eg. My processor id is 12345. A friend brings a program he made and installs it on my pc. The wizard first looks for the processor id (12345) then generates a code. How would that be done
    2. What are add-ons I saw them in the create project form but don't know how to use them or what they are. Can someone direct me please
    3. How can you make an application scan a whole pc (like a search application) And can you show progress with a loading bar
    4. How do you close a form so it doesn't have a place in the task bar and it isn't visible when the next form is shown

    Thank you for your first support, and I hope that these and the previous questions will help many people.

    Thanks,

    Eragon.



  • Andy Britcliffe

    1) yes it is. How Not sure. Take a look at the TabControl component - I've never worked with it so can't comment on that :-)

    2) Well if you deploy it using say the standard Windows setup and deployment project then you have a feature to create a shortcut in the start menu. Not sure about ClickOnce if it does this or not. Programmatically in code you can but requires the use of IWshRuntme library.

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=673469&SiteID=1

     

    4) not sure but I would invest in network security/proxy server/website filtering software as it would be much easier than making your own

    5) yes it is. The webbrowser control has a progressChanged event which you can implement and show the progress. It will fire when the progress has been changed of loading a document.

    The WebBrowserProgressChangedEventArgs gives you 2 properties. The CurrentProgress of the page and the MaximumProgress, which will get you the total number of bytes loaded (long data type)

    http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.progresschanged.aspx

    6) indeed it is. Place a back button for example and use the webbrowser's GoBack() method. This will look in the history and go back. Also use GoForward() method to...go forward ;-)

    I hope this has helped you in some way



  • Jeff Williams

    hi,

    I'm not sure I understand that, but thanks anyway, but I'd mainly like the first question answered as it is the most vital one to the application i'm making.

    thanks,

    Eragon.



  • Sameep

    Hi,

    What are you talking about

    Thanks,

    Eragon.



  • Benedikt

    Yes. That is what I'd like to know about. Is it possible or was IE7 not created with MS's own software developing tool

    Thanks,

    Eragon.



  • Brian Hsi - MSFT

    It is easily done my friend. Here is some code for the tabs. All you need to do is have a staus bar with a progress bar on and a tab control:

    //*************************** Tab Controls ****************************//

    private void Create_a_new_tab()
    {

    TabPage newpage = new TabPage("Loading...");

    tabpages.Add(newpage);

    tabControl1.TabPages.Add(newpage);

    if (current_tab_count == 10) return;

    WebBrowser webpage = new WebBrowser();
    webpage.ProgressChanged += new WebBrowserProgressChangedEventHandler(webpage_ProssesChanged);

    webpage.Parent = newpage;

    webpage.Dock = DockStyle.Fill;

    webpages.Add(webpage);

    webpage.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webpage_DocumentCompleted);

    webpage.Navigate(HomePage);

    tabControl1.SelectedTab = newpage;
    }

    void webpage_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
    UpdateAllNames();
    comboBoxurl.Text = e.Url.ToString();
    ModifyNavigationButtons();
    }

    private WebBrowser GetCurrentWebBrowser()
    {
    TabPage current_tab = tabControl1.SelectedTab;
    WebBrowser thiswebpage = (WebBrowser)webpages[tabpages.IndexOf(current_tab)];
    return thiswebpage;
    }

    private void UpdateName(TabPage tb)
    {

    TabPage current_tab = tb;
    WebBrowser thiswebpage = (WebBrowser)webpages[tabpages.IndexOf(current_tab)];

    if (thiswebpage.Document != null)
    current_tab.Text = thiswebpage.Document.Title;
    else
    current_tab.Text = "Zzz";
    }

    private void UpdateAllNames()
    {
    // Update all the tab names for all the currently open web pages.

    foreach (TabPage tb in tabControl1.TabPages)
    {
    UpdateName(tb);
    }
    }

    and if you want the status bar to work with this then :

    private void webpage_ProssesChanged(object sender, WebBrowserProgressChangedEventArgs e)
    {
    WebBrowser thiswebpage = GetCurrentWebBrowser();

    WebBrowser item = sender as WebBrowser;

    /* The CurrentProgress variable from the raised event
    * gives you the current number of bytes already downloaded
    * while the MaximumProgress is the total number of bytes
    * to be downloaded */
    if (e.CurrentProgress < e.MaximumProgress)
    {
    // Check if the current progress in the progress bar
    // is >= to the maximum if yes reset it with the min
    if (pbStatus.Value >= pbStatus.Maximum)
    pbStatus.Value = pbStatus.Minimum;
    else
    // Just increase the progress bar
    pbStatus.PerformStep();
    }
    else
    // When the document is fully downloaded
    // reset the progress bar to the min (0)
    pbStatus.Value = pbStatus.Minimum;
    }

    I hope this is what your looking for,

    Simon

  • stallion_alpa

    I'm sure the first question's response is using a TabControl component. Take a look at this and see if it helps:

    http://www.c-sharpcorner.com/Code/2003/Dec/TabControlTutorial.asp

    http://www.c-sharpcorner.com/Tutorials/WorkingWithTabControlP1.asp



  • AlucardHellSing

    well the code in the link supplied gives you what you need :-)

    you just need to implement the event. click on the webbrowser control and view its properties. Then view its events and double click the progressChanged event. From there just look at the e.CurrentProgress and that's it. The documentation also provides an example I believe



  • FrankLi

    Currently you can't find that kind of control from MS toolbox, but you can use some third party control. Probably all of them that makes windows form package of controls like infagistics, component one and others have such control. I use one of them and the maker is DevComponents. This control is part of DotNetBar package and the name is TabStrip. Works the same as open documents in VS and all you have to do is to set one property of MDI form and all forms that have to be added as tabs to have MdiParent to be MDI form. Everything is done automatically.

  • Peter Aspect

    hi,

    sorry to say, but only number 6 was the helpful one but the no. 5 could be more helpful if you specify the code.

    thanks.

    Eragon.



  • Many a C# Question