我敢肯定在你的程序中有somthing=null(components = null不算),问题就应该出在这里。
                                                                     祝好运
                                                                     接分

解决方案 »

  1.   

    private AddressData[] addressData = new AddressData[30]; private static readonly AddressData Invalid = new AddressData("?","?","?","?","");



    public AddressData Search_PostCode(string pc)
    {
    int a = 0;
    for(int i=0; i < addressData.Length; i++)
    {
    if(addressData[i].getPostCode() == pc)
    {
    a = i;
    }
    else
    {
    a = 0;
    }
    }
    if(a != 0)
    {
    return addressData[a];
    }
    else
    {
    return Invalid;
    }

    }// end Search Method;
    以上是在一个名为AddressList的class里面的method
    下面的是在form里的
    private void postCode1_TextChanged(object sender, System.EventArgs e)
    {
    AddressData ad;
    try
    {
    if (al != null)
    {
    ad = al.Search_PostCode(sender.ToString());
    if (ad != null)
    {
    House.Text = ad.getHouse();
    Street.Text = ad.getStreet();
    City.Text = ad.getCity();
    County.Text = ad.getCounty();
    }
    }
    }
    catch(Exception exception1)
    {
    MessageBox.Show(exception1.Message,"Must enter a postcode",MessageBoxButtons.OK,MessageBoxIcon.Error);
    }
    }
    其中House, Street, City和County全是label
    postCode1是我调用的一个dll,实际上就是继承textbox属性
    我敢保证这个dll没有问题帮我看看吧