如何掉落文本框中的项目 [英] how to fall item in textbox
本文介绍了如何掉落文本框中的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在文本框中单击它时,我正在使用MS Access访问数据库,我希望该项目属于秋天.一件事很清楚,我不想使用模块和类,我想在表单类和表单加载中键入代码……不要说我们不会键入您的名字...或显示编码..如果可以,请提供帮助
i am using ms access for database i want fall item when click in textbox it. ONE thing clear i don''t want to use module and class i want to type code in form class and form load ...............don''t say we won''t type for YOU ...or show the coding..please help if can sorry
推荐答案
我不确定您的意思,但是...这是我经常从MSDB放置呼叫项,如果您可以从中提取一些东西并解决问题,那么欢迎您:)
I''m not really sure what you mean but... this is somthing i use to put call items from a MSDB, if you can pull something from this and solve your problem then you are welcome to it :)
Public Structure NewsItems
Dim Title As String
Dim Messege As String
Dim DateNews As String
End Structure
Public Shared Function Function_NewsItems( _
ByRef Requested As String) As NewsItems
Dim DBConn As New OleDbConnection(ProviderJet4 + _
System.Web.HttpContext.Current.Server.MapPath( _
"../App_Data/NewsNotice.mdb"))
Dim DBQueryStr As New StringBuilder
DBQueryStr.Append("SELECT TOP " + Requested + _
" ID, NewsDate, NewsTitle, NewsMessage ")
DBQueryStr.Append("FROM GlobalNews ")
DBQueryStr.Append("ORDER BY ID DESC ")
Dim Get_NewsItems As NewsItems 'Change For Easy Reading
Dim RawDate As Date
Get_NewsItems.DateNews = Nothing 'Clean Structure Value
Get_NewsItems.Messege = Nothing 'Clean Structure Value
Get_NewsItems.Title = Nothing 'Clean Structure Value
Dim DBCommQuery As String = DBQueryStr.ToString
Try
DBConn.Open()
Dim DBComm As New OleDbCommand(DBCommQuery, DBConn)
Dim DBReader As OleDbDataReader = DBComm.ExecuteReader()
While DBReader.Read()
RawDate = DBReader.Item(1)
Get_NewsItems.Title = DBReader.Item(2)
Get_NewsItems.Messege = DBReader.Item(3)
Get_NewsItems.DateNews = RawDate.ToString("dd'" + _
DayDateSuffix(RawDate.Day) + "' MMMM yyyy")
End While
DBConn.Close()
Catch ex As Exception
Finally
DBConn.Dispose()
End Try
Return Get_NewsItems
End Function
一旦运行此功能,您就可以简单地使用诸如此类的东西...
Once this function has run you can simply use somthing like this...
Dim Output1 = App_Static.Function_NewsItems("1")
Me.SBL_News_Literal_TextBox.Text = Output1.Title + _
vbNewLine + _
Output1.Messege + _
vbNewLine + _
Output1.DateNews
请记住,这是我自己的项目之一,仅是一个指针.
祝你好运.
Remember this is somthing from one of my own projects and is just a pointer.
Good Luck.
这篇关于如何掉落文本框中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文