本文介绍了当我在组合框中选择一个字段时,如何在富文本框中显示特定数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 能否帮我解决以下情况的c#代码。 1.当我在组合框中选择特定值时,它必须从数据库中检索其相关信息并显示在richtextbox上。 2.当我想在数据库中显示richtextbox中的日期时,如何将日期时间选择器转换为字符串。 3.如何发送outlook电子邮件使用组合框中所选特定字段的内容。 for ref: 我已粘贴了代码。 while (myReader.Read()) { string sEmployeeID = myReader.GetString( 雇员); string sName = myReader.GetString( 名称); DateTime sFromDate = myReader.GetDateTime( FromDate); DateTime sToDate = myReader.GetDateTime( ToDate); string sSignum = myReader.GetString( Signum ); string sComment = myReader.GetString( 注释); richTextBox1.Text = sEmployeeID; richTextBox1.Text = sName; richTextBox1.Text = sSignum; richTextBox1.Text = sComment; richTextBox1.Text = sFromDate; richTextBox1.Text = sToDate; } } catch (Exception ex) { MessageBox.Show(ex.Message); } 解决方案 Hi,Can you please help me out with the c# code for the following scenario.1. When I select a particular value in combo box, it must retrive its related information from the database and display on richtextbox .2. How to convert the date time picker into string when I want to display the date in richtextbox from database.3. How can I send an outlook email with the contents of the selected particular field in combobox.for ref:I have pasted the code .while (myReader.Read()) { string sEmployeeID = myReader.GetString("EmployeeID"); string sName = myReader.GetString("Name"); DateTime sFromDate = myReader.GetDateTime("FromDate"); DateTime sToDate = myReader.GetDateTime("ToDate"); string sSignum = myReader.GetString("Signum"); string sComment = myReader.GetString("Comment"); richTextBox1.Text = sEmployeeID; richTextBox1.Text = sName; richTextBox1.Text = sSignum; richTextBox1.Text = sComment; richTextBox1.Text = sFromDate; richTextBox1.Text = sToDate; } } catch (Exception ex) { MessageBox.Show(ex.Message); } 解决方案 这篇关于当我在组合框中选择一个字段时,如何在富文本框中显示特定数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 19:29