C# 在同一解决方案中将textbox.text从web表单访问到类库时出错
类库代码: 此代码在BlackBaud Crm中将行添加到批处理中。 它使用web表单设计中的文本框和组合框。 即使在异常部分,它也给出了BatchException的错误C# 在同一解决方案中将textbox.text从web表单访问到类库时出错,c#,.net,C#,.net,类库代码: 此代码在BlackBaud Crm中将行添加到批处理中。 它使用web表单设计中的文本框和组合框。 即使在异常部分,它也给出了BatchException的错误 public string AddRowToBatch(string param) { Guid SaveRequestGUID = default(Guid); Dictionary<string, string> BatchRowValues = new Di
public string AddRowToBatch(string param)
{
Guid SaveRequestGUID = default(Guid);
Dictionary<string, string> BatchRowValues = new Dictionary<string, string>();
int ISORGANIZATION = 0;
string type = "Individual";
try{
if (type == "Individual")
{
ISORGANIZATION = 0;
}
else
{
ISORGANIZATION = 1;
}
BatchRowValues.Add(this.comboBox1.Tag.ToString, ISORGANIZATION.ToString);
BatchRowValues.Add(this.textBox2.Tag.ToString, this.textBox2.Text.ToString);//key name
BatchRowValues.Add(this.comboBox2.Tag.ToString, ((SimpleAddressType)this.comboBox2.SelectedItem).AddressType.ToString);//address type
BatchRowValues.Add(this.textBox3.Tag.ToString, this.textBox3.Text.ToString);//address
BatchRowValues.Add(this.textBox4.Tag.ToString, this.textBox4.Text.ToString);//city
BatchRowValues.Add(this.comboBox4.Tag.ToString, ((SimpleState)this.comboBox4.SelectedItem).StateID.ToString);//state
BatchRowValues.Add(this.comboBox3.Tag.ToString, ((SimpleCountry)this.comboBox3.SelectedItem).getCountryID.ToString);//country
BatchRowValues.Add(this.textBox5.Tag.ToString, this.textBox5.Text.ToString);
int _batchRowSequence;
_batchRowSequence += 1;
SaveRequestGUID = _helper.BatchSaveRequest(_currentBatchID, BatchRowValues, _batchRowSequence);
//ClearBatchRow();
//button4_Click.Enabled = CheckEnableAddRowToBatchButton();
}
catch (BatchException ex)
{
Interaction.MsgBox(ex.BatchErrorMessage, MsgBoxStyle.Exclamation);
}
catch (Exception ex)
{
Interaction.MessageBox(ex.Message);
//Interaction.MsgBox(ex.Message);
}
return "successfull";
}
异常消息是什么?错误2“BlackBaudRepository.BBDataOperations”不包含“comboBox1”的定义,并且找不到接受“BlackBaudRepository.BBDataOperations”类型的第一个参数的扩展方法“comboBox1”(是否缺少using指令或程序集引用?)C:\Users\abcfolder\Desktop\BBDemoAlpha.v.3\BBDemoAlpha\BBDemoAlpha\BlackBaudRepository\BBDataOperations.cs 246 37 BlackBaudRepository组合框是web表单的成员,而不是BBDataOperations类的成员。您需要将对表单或组合框的引用传递给该方法。
private void button4_Click(object sender, EventArgs e)
{
BBDataOperations obj = new BBDataOperations();
obj.AddRowToBatch();
//MessageBox.Show(obj.AddRowToBatch());
}