我想在C#中将两个组合框值连接到GridView
的1列中。我正在使用此代码,但它没有连接它..
private void linetotal_KeyUp(object sender, KeyEventArgs e)
{
if(e.KeyCode==Keys.Enter)
{
object[] values = { cbxclassstd.Text,cbxfee.Text,
feeamount.Text,disc.Text,linetotal.Text};
this.dgvvoucher.Rows.Add(values);
}
}
答案 0 :(得分:2)
使用string.Join
将dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:27.+'
compile 'com.android.support:design:27.+'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.android.gms:play-services-location:12.0.1'
compile 'com.google.android.gms:play-services-maps:12.0.1'
compile 'com.google.android.gms:play-services-places:12.0.1'
compile 'com.androidmapsextensions:android-maps-extensions:2.4.0'
testCompile 'junit:junit:4.12'
}
的值连接到一列:
Combobox
如果您只需要连接前两项:
this.dgvvoucher.Rows.Add(string.Join("", values));//Or string.Join(",", values)