Continuous bad luck

  • Thread starter Thread starter m.wolfe
  • Start date Start date
M

m.wolfe

Y'all

Seems like I can't make any of the examples work. Here's one I've tweaked.
The listbox is actually much larger than need be. However, clicking, keying
and slamming my keyboard haven't resulted in any text on the listbox. Your
help appreciated.

m.wolfe

namespace fontFamilyExample
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}


private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//listBox1.Width = 200;
//listBox1.Location = new Point( 40, 120 );
foreach (FontFamily oneFontFamily in FontFamily.Families)
{
listBox1.Items.Add( oneFontFamily.Name );
}
}
}
}

I realize authors many times insert logic errors into their code to make you
think. However it looks to me, after tooling with them, that the program
should run. I have used small examples, like the one given here. I have
installed .Net 3.5 SP1 and use VS 2008. This particular example is copied
from the local help system and tooled a bit.
 
Y'all

Seems like I can't make any of the examples work.  Here's one I've tweaked.
The listbox is actually much larger than need be.  However, clicking, keying
and slamming my keyboard haven't resulted in any text on the listbox.  Your
help appreciated.

m.wolfe

namespace fontFamilyExample
{
   public partial class Form1 : Form
   {
      public Form1()
      {
         InitializeComponent();
      }

      private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
      {
         //listBox1.Width = 200;
         //listBox1.Location = new Point( 40, 120 );
         foreach (FontFamily oneFontFamily in FontFamily.Families)
         {
            listBox1.Items.Add( oneFontFamily.Name );
         }
      }
   }

}

I realize authors many times insert logic errors into their code to make you
think.  However it looks to me, after tooling with them, that the program
should run.  I have used small examples, like the one given here.  I have
installed .Net 3.5 SP1 and use VS 2008.  This particular example is copied
from the local help system and tooled a bit.

Hi,

The code has no sense whatsoever, you are trying to add the items in
the selectedIndex changed, of course that if there are no items in the
list the selectedIndexChanged will never happen :)
do the loop in the form load instead

and buy another book
 
Y'all

Seems like I can't make any of the examples work.  Here's one I've tweaked.
The listbox is actually much larger than need be.  However, clicking, keying
and slamming my keyboard haven't resulted in any text on the listbox.  Your
help appreciated.

m.wolfe

namespace fontFamilyExample
{
   public partial class Form1 : Form
   {
      public Form1()
      {
         InitializeComponent();
      }

      private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
      {
         //listBox1.Width = 200;
         //listBox1.Location = new Point( 40, 120 );
         foreach (FontFamily oneFontFamily in FontFamily.Families)
         {
            listBox1.Items.Add( oneFontFamily.Name );
         }
      }
   }

}

I realize authors many times insert logic errors into their code to make you
think.  However it looks to me, after tooling with them, that the program
should run.  I have used small examples, like the one given here.  I have
installed .Net 3.5 SP1 and use VS 2008.  This particular example is copied
from the local help system and tooled a bit.

Hi,

The code has no sense whatsoever, you are trying to add the items in
the selectedIndex changed, of course that if there are no items in the
list the selectedIndexChanged will never happen :)
do the loop in the form load instead

and buy another book
 
LOL

I think I want to buy that book. A little humour in the world...

If font families is a collection you maybe able to bind the list box
directly to it. But in the Page Load of course.
 
LOL

I think I want to buy that book. A little humour in the world...

If font families is a collection you maybe able to bind the list box
directly to it. But in the Page Load of course.
 
Back
Top