Re: problems with user control

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



using System;

using System.Collections;

using System.ComponentModel;

using System.Drawing;

using System.Data;

using System.Windows.Forms;

namespace Biller

{

/// <summary>

/// Summary description for StoreSelector.

/// </summary>

public class StoreSelector : System.Windows.Forms.UserControl

{

private static int index;

public System.Windows.Forms.ComboBox comboBox1;

/// <summary>

/// Required designer variable.

/// </summary>

private System.ComponentModel.Container components = null;

public StoreSelector()

{

// This call is required by the Windows.Forms Form Designer.

InitializeComponent();


// TODO: Add any initialization after the InitForm call

}

public static void setIndex(int i)

{

index = i;

}

public static int getIndex()

{

return index;

}

public static Store getSelectedStore()

{


return StoresCollection.getStoreAtIndex(index);


}

private void storeList()

{

this.comboBox1.Items.Clear();

ArrayList stores = new ArrayList(StoresCollection.getStores());

Object storesNames = new Object[stores.Count];

for(int x=0; x< stores.Count;x++)

{

this.comboBox1.Items.Add(((Store)stores[x]).storeName);

}


if(this.comboBox1.Items.Count > 0)

this.comboBox1.SelectedIndex = index;



}

public void load()

{

try

{

this.storeList();

this.comboBox1.SelectedIndex = index;

}

catch{}

}



/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if(components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

#region Component Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.comboBox1 = new System.Windows.Forms.ComboBox();

this.SuspendLayout();

//

// comboBox1

//

this.comboBox1.ItemHeight = 13;

this.comboBox1.Name = "comboBox1";

this.comboBox1.Size = new System.Drawing.Size(176, 21);

this.comboBox1.TabIndex = 0;

this.comboBox1.SelectedIndexChanged += new
System.EventHandler(this.comboBox1_SelectedIndexChanged);

//

// StoreSelector

//

this.Controls.AddRange(new System.Windows.Forms.Control[] {

this.comboBox1});

this.Name = "StoreSelector";

this.Size = new System.Drawing.Size(176, 24);

this.Resize += new System.EventHandler(this.StoreSelector_Resize);

this.ResumeLayout(false);

}

#endregion

private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs
e)

{

index = this.comboBox1.SelectedIndex;

}

public void addSelectedEvent(System.EventHandler eh)

{

this.comboBox1.SelectedIndexChanged += new System.EventHandler(eh);


}

private void StoreSelector_Resize(object sender, System.EventArgs e)

{

this.comboBox1.Size = this.Size;

}

public void setSelectedIndex(int i)

{

this.comboBox1.SelectedIndex = i;

index = i;

}

}



}


.



Relevant Pages

  • static members
    ... main.obj: error LNK2001: unresolved external symbol "private: static int ... static void init(); ...
    (comp.lang.cpp)
  • static members
    ... main.obj: error LNK2001: unresolved external symbol "private: static int ... static void init(); ...
    (comp.lang.cpp)
  • Re: Data Object Collection Inheritance
    ... > private System.Windows.Forms.ListBox listBox1;> private System.Windows.Forms.Button cmdID;> private System.Windows.Forms.Button cmdText; ... > private void InitializeComponent() ... > // TODO: Add BaseDataCollection.IsReadOnly getter implementation> return false; ... > public sealed class SubClassCollection: ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Problem in converting to C#
    ... public delegate void delegate1 ... private void InitializeComponent() ... private void Button1_Click(object sender, System.EventArgs e) ... Private Sub Form1_Load(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Redraw problem - please help
    ... >> public int CurrentX; ... >> public void Create ... >> private System.ComponentModel.IContainer components; ...
    (microsoft.public.dotnet.framework.drawing)