本文介绍了表中的空行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

am使用此代码从表单向表中插入多行,并且可以正常工作.但是当表单的一部分为空时,它将在孔行中插入空白.我怎样才能防止这种情况

表单后面的代码

am using this code to insert multiple rows into a table from a form and it works alright. but when part of the form is empty, it inserts empty space in the hole row. how can i prevent this

code behind form

try
{
    if (string.IsNullOrEmpty(txtActivity1.Text))
    {
        MessageBox.Show("Type Your First Activity");
        return;
    }
    clsCategory person = new clsCategory();
    
    var  _with1 = person;
    _with1.oneCategory = this.txtCategory1.Text;
    _with1.twoCategory = this.txtCategory2.Text;
    _with1.threeCategory = this.txtCategory3.Text;
    _with1.fourCategory = this.txtCategory4.Text;
    _with1.fiveCategory = this.txtCategory5.Text;
    _with1.oneActivity = this.txtActivity1.Text;
    _with1.twoActivity = this.txtActivity2.Text;
    _with1.threeActivity = this.txtActivity3.Text;
    _with1.fourActivity = this.txtActivity4.Text;
    _with1.fiveActivity = this.txtActivity5.Text;
    _with1.saveRegister();
    clearScreen();
    MessageBox.Show("Record is successfully Added");
    
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}

推荐答案


这篇关于表中的空行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 20:33