Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

Juan1R

@Juan1R
About
Posts
5
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • problem with DateTime objects
    J Juan1R

    According to the .Net Documentation of AddYears: "This method does not change the value of this DateTime. Instead, a new DateTime is returned whose value is the result of this operation."

    C# help

  • Tooltip for Combobox
    J Juan1R

    Hope this helps: - Change the DrawMode property of your combo box to OwnerDrawFixed. - Implement the event DrawItem of the combo box and write there something like this:

        ToolTip tt = new ToolTip();
        private void comboBox1\_DrawItem(object sender, DrawItemEventArgs e) {
            e.DrawBackground();
    
            e.Graphics.DrawString(comboBox1.Items\[e.Index\].ToString(),
                e.Font, e.State == DrawItemState.Selected ? Brushes.White : Brushes.Black, e.Bounds, StringFormat.GenericDefault);
            e.DrawFocusRectangle();
            tt.Show(comboBox1.Items\[e.Index\].ToString(), comboBox1, 1000);
        }
    

    This event is now called whenever an item is displayed. Now you have to insert the text that draws the combo items and, by the way, you update the tool tip with the information you want to show about the item.

    Windows Forms

  • Why use the 'instanceof' Java operator when you can rethrow an exception?
    J Juan1R

    It seems this coder didn't see the point of the Java "instanceof" operator:

    protected void processException(Throwable e)
    throws ParqProsaException
    {
    try
    {
    throw e;
    }
    catch(SQLException se)
    {
    ParqSQLSadException pre = new ParqSQLSadException(se);
    throw new ParqErrorContainerException(pre, " ... ");
    }
    catch(Throwable exx)
    {
    super.processException(exx);
    }
    }

    The Weird and The Wonderful java question

  • Closing a form
    J Juan1R

    The reason why the application exits automatically is that the entry point for it is located in a class usually called Program.cs that has the following code: static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } The last line (Application.Run(new Form1())), starts a message loop that ends as soon as the main form is closed (new Form1()), what causes the end of the application. To prevent the application from exiting I've found two possible solutions based on your original idea: 1. The first one is not to close the main form but to hide it: private void button1_Click(object sender, EventArgs e) { Form2 frm2 = new Form2(); frm2.Show(); this.Hide(); } 2. The second is to invoke the Application.Run() overload that doesn't take a Form as parameter but an ApplicationContext. This object (that always exist), implements an overridable method called OnMainFormClosed() that is responsible of shutting down the application when the main form is closed. To prevent this from happening, you can derive a new class from it that substitutes the original method by another that does nothing: //New class. class ApplicationContextOwn : ApplicationContext { //Overriden method does nothing protected override void OnMainFormClosed(object sender, EventArgs e) { } } static class Program { public static ApplicationContext ac = new ApplicationContext(); /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //The application is started using an instance of the new class. ApplicationContext ac = new ApplicationContextNew(); ac.MainForm = new Form1(); Application.Run(ac); } } Hope this helps.

    C# question help

  • increase the code of symbols
    J Juan1R

    I've tried your code in Microsoft Visual C++ 6.0 in an ANSI system and it seems to work properly. That is, it first displays "ABC" and then "BCD".

    C / C++ / MFC tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups