问一下各位朋友,关于C#把在用DataGridView显示出来的数据源,显示在文本框的问题

arvins97 2012-08-26 11:52:45


主界面
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace frmMain
{
public partial class frmMain : Form
{

public frmMain()
{
InitializeComponent();
}
#region 调用出手机信息维护系统
private void ToolStripMenuItem_Click_1(object sender, EventArgs e)
{
mobileInfoVindicate mobileinfovindicate = new mobileInfoVindicate();
mobileinfovindicate.Show();
//
mobileinfovindicate.MdiParent = this;
}
#endregion
#region 退出系统
private void tsdbt_Exit_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("你确定要退出本程序吗?", "提示!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
this.Close();
}
}
#endregion
}
}



子窗体里的功能

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace frmMain
{
public partial class mobileInfoVindicate : Form
{
public mobileInfoVindicate()
{
InitializeComponent();
}

/// <summary>
/// 单击搜索所出来的数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void blb_Beat_Click(object sender, EventArgs e)
{

const string sql = "Data Source=.;Initial Catalog=MobileDB;User Id=sa;Pwd=sasa";
SqlConnection conn = new SqlConnection(sql);
string sqlOne = string.Format("select * from Mobile where Brand like'%{0}%'", txt_Input.Text);
SqlCommand comm = new SqlCommand(sqlOne, conn);
DataSet dst = new DataSet("MobileDB");
SqlDataAdapter dataa = new SqlDataAdapter(comm);
dataa.Fill(dst, "MobileInfo");
dtgv_Tools.DataSource = dst.Tables["MobileInfo"];


}

#region 退出手机维护界面
private void tsdbt_Exit_Click_1(object sender, EventArgs e)
{

DialogResult result = MessageBox.Show("确定要退出界面吗?", "aa", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
this.Close();
}
}
#endregion


}
}



...全文
75 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
arvins97 2012-08-26
  • 打赏
  • 举报
回复
“http://hi.baidu.com/arvins97/album/item/5b3a3cc9e71190effbb3e042ce1b9d16fcfa6083.html#”你们可以我的空间看我的图片,问题很麻烦,麻烦各位了,谢谢。
arvins97 2012-08-26
  • 打赏
  • 举报
回复
没让你们看到图。 唉。
arvins97 2012-08-26
  • 打赏
  • 举报
回复

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧