使combox信息出现在列表视图中

使combox信息出现在列表视图中

本文介绍了使combox信息出现在列表视图中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试制作客户经理程序.而且我想插入他/她来自哪个国家,但是我无法在ListView中显示国家信息.



我有一个Form1 = mainForm类

和Form2 = CustomerFrame类

MainForm = listview

CustomerFrame =您在其中键入名称,电话号码等信息的信息



在CustomerFrame内部

Hi im trying to make a customer manager program. And i want to insert which countries he/she is from but i can not make the country information show in my ListView.



I have a Form1 = mainForm class

and Form2 = CustomerFrame class

MainForm = listview

CustomerFrame = where you type info like name, phone nr, etc



inside CustomerFrame

internal CustomerFiles.Countries countryinfo {get; set;}




 address.Country = new CustomerFiles.Countries(cbCountry.Text);

countryinfo = address.Country;

public override string ToString()
{
return string.Format("[{0}, {1}]",contact.ToString(), address.ToString());
}


//在国家/地区内部类




//inside Countries class



class Countries
{

public int CountryId { get; set; }


public string Name { get; set; }


public Countries()

{
}
public Countries(string x)

{

}

 }


内部地址类


inside Adress class

class Address
{

public Countries country;

}
}
get
{
return country;
}
set
{
country = value;

public override string ToString()
{
    return string.Format("[{0}, {1}, {2}, {3}]", city, zipCode, country, street);
}



在MainForm内



inside MainForm

private void MainForm_Load(object sender, EventArgs e)
{

    if (customerframe.ShowDialog() == DialogResult.OK)            {

        listView1.Items.Add(String.Format("[{0}]", customerframe.ToString()));

    }
}



当尝试选择国家/地区时,我会在列表视图中看到"CustomerRegister1.CustomerFiles.Countries"而不是国家/地区名称.我该怎么办,解决方案是什么?在此先感谢



when trying to choose a country i get this in my listview"CustomerRegister1.CustomerFiles.Countries" instead of the country name. What can i do, whats the solution to this?! Thanks in advance

推荐答案


这篇关于使combox信息出现在列表视图中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 12:01