如何为文本框分配功能 [英] how to assign a function to a textbox
本文介绍了如何为文本框分配功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
我编写了一个从数据库中获取员工ID的函数,我想在文本框中显示它.请告诉我如何分配它.
实际上,我想在组合框选择上显示emp_id.
Hi all
i wrote a function to fetch the employee id from database and i want to show it in a textbox.please tell me how to assign that.
actually i want to display the emp_id on a combobox selection.
推荐答案
简单:-
textbox.Text = yourfunction()
Simple:-
textbox.Text = yourfunction()
Dim con As New SqlConnection()
con.ConnectionString = Con1.ConString()
con.Open()
Dim cmd As New SqlCommand("detailview ''" & TextBox1.Text & "''", con)
Dim dr As SqlDataReader
dr = cmd.ExecuteReader
While dr.Read
TextBox1.Text = dr(0).ToString
TextBox2.Text = dr(1).ToString
TextBox3.Text = dr(2).ToString
TextBox4.Text = dr(3).ToString
End While
con.Close()
会起作用
it will work
这篇关于如何为文本框分配功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文