连续数据表格 [英] Continuous Data Form
问题描述
我正在尝试创建一个显示数据的表单,比如Access连续
数据表而不是使用数据网格。
我想我可以通过创建一行文本框来实现这一目标,每个字段需要显示一个
。为我显示和填充文本框的
前n个记录创建一个控件数组。然后为数据表中的记录数设置一个
垂直滚动条。
当点击或拖动滚动条时,我需要为每个记录/字段重新创建
控件数组。
有没有更简单的方法来实现这个结果?
谢谢
道格
面团,
看到我曾经制作过的这个样本,我认为它可以帮助您解决问题。
您当然必须使用文本框而不是按钮。
我希望这有帮助吗?
Cor
\\\你可以粘贴它直接在一个创建的项目代码中
Private Sub Form1_Load(ByVal sender As Object,_
ByVal e As System.EventArgs)处理MyBase.Load
Dim start As Integer = 4
Dim top As Integer = 25
Dim i As Integer
Dim nowdate As DateTime = DateTime.Now
Dim mybutton(System.DateTime.DaysInMonth _
(nowdate.Year,nowdate.Month))As Button
For i = 0 To System.DateTime.DaysInMonth _
(nowdate.Year,nowdate.Month) - 1
mybutton(i)= New Button
mybutton(i)。TextAlign = ContentAlignment.MiddleCenter
mybutton(i).Width = 40
mybutton(i).Height = 20
mybutton(i).FlatStyle = FlatStyle.Flat
mybutton(i).BackColor = Drawing.Color.AntiqueWhite
mybutton(i).Location = New System.Drawing .Point(start,top)
mybutton(i).Text =(i + 1).ToString
mybutton(i).Cursor = Cursors.Hand
Me.Controls.Add(mybutton(i))
AddHandler mybutton(i)。点击,AddressOf mybutton_Click
AddHandler mybutton(i).MouseHover, AddressOf mybutton_Hoover
AddHandler mybutton(i).MouseLeave,AddressOf mybutton_Leave
start = start + 40
If(i + 1)Mod 5 = 0然后
top = top + 20
start = 4
结束如果
下一页
结束子
Private Sub mybutton_Click _
(ByVal sender As Object,ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender,Button)
MessageBox.Show(" The day is:" &安培; thisbutton.Text)
End Sub
Private Sub mybutton_Hoover _
(ByVal sender As Object,ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(发件人,按钮)
thisbutton.BackColor = Drawing.Color.AliceBlue
End Sub
Private Sub mybutton_Leave _
(ByVal sender As Object,ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender,Button)
thisbutton.BackColor = Drawing.Color.AntiqueWhite
End Sub
///
< blockquote>谢谢Cor。
这样你是否可以解决创建类似
连续形式的Access的需求?
" Cor Ligthert" <无************ @ planet.nl>写在消息
新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...
面团,
看看我曾经制作的这个样本,我认为它可以帮助解决你的问题。
你必须使用文本框而不是按钮。 />
我希望这有帮助吗?
你可以将它直接粘贴到创建的项目代码中
私有子Form1_Load(ByVal sender As Object,_
ByVal e As System.EventArgs)Handles MyBase.Load
Dim start As Integer = 4
Dim top As Integer = 25
Dim i As整数
Dim nowdate As DateTime = DateTime.Now
Dim mybutton(System.DateTime.DaysInMonth _
(nowdate.Year,nowdate.Month))As Button
For i = 0至System.DateTime.DaysInMonth _
(nowdate.Year,nowdate.Month) - 1
mybutton(i)= New Button
mybutton(i).TextAlign = ContentAl ignment .MiddleCenter
mybutton(i).Width = 40
mybutton(i).Height = 20
mybutton(i).FlatStyle = FlatStyle.Flat
mybutton(i)。 BackColor = Drawing.Color.AntiqueWhite
mybutton(i).Location = New System.Drawing.Point(start,top)
mybutton(i).Text =(i + 1).ToString
mybutton(i).Cursor = Cursors.Hand
Me.Controls.Add(mybutton(i))
AddHandler mybutton(i)。点击,AddressOf mybutton_Click
AddHandler mybutton(i)。 MouseHover,AddressOf mybutton_Hoover
AddHandler mybutton(i).MouseLeave,AddressOf mybutton_Leave
start = start + 40
如果(i + 1)Mod 5 = 0那么
top = top + 20
start = 4
结束如果
下一页
结束Sub
Private Sub mybutton_Click _
(ByVal sender As Object,ByVal e As System.Event Args)
Dim thisbutton As Button = DirectCast(发送者,按钮)
MessageBox.Show(" The day is:" &安培; thisbutton.Text)
End Sub
Private Sub mybutton_Hoover _
(ByVal sender As Object,ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender,Button)
thisbutton.BackColor = Drawing.Color.AliceBlue
End Sub
Private Sub mybutton_Leave _
(ByVal sender As Object,ByVal e As System.EventArgs)
Dim thisbutton作为Button = DirectCast(发件人,按钮)
thisbutton.BackColor = Drawing.Color.AntiqueWhite
End Sub
///
Doug,
很难回答我,因为我不知道什么是Access,比如
连续形式。
但是你写道,你想过动态建立文本框,这个
做同样的事情。
Cor
" Doug Bell" < dug @ bigpond>
...谢谢Cor。
这是解决创建Access的要求吗?
连续形式?
Cor Ligthert <无************ @ planet.nl>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...面团,
看看我曾经制作的这个样本,我认为它可以帮助解决你的问题。
你必须使用文本框而不是按钮。
你可以将它直接粘贴到创建的项目代码中
Private Sub Form1_Load(ByVal sender)作为对象,_
ByVal e As System.EventArgs)处理MyBase.Load
Dim start As Integer = 4
Dim top As Integer = 25
Dim i As Integer
Dim nowdate As DateTime = DateTime.Now
Dim mybutton(System.DateTime.DaysInMonth _
(nowdate.Year,nowdate.Month))As Button
For i = 0 To System.DateTime .DaysInMonth _
(nowdate.Year,nowdate.Month) - 1
mybutton(i)= New Button
mybutton(i).TextAlign = ContentAlignme nt.MiddleCenter
mybutton(i).Width = 40
mybutton(i).Height = 20
mybutton(i).FlatStyle = FlatStyle.Flat
mybutton(i)。 BackColor = Drawing.Color.AntiqueWhite
mybutton(i).Location = New System.Drawing.Point(start,top)
mybutton(i).Text =(i + 1).ToString
mybutton(i).Cursor = Cursors.Hand
Me.Controls.Add(mybutton(i))
AddHandler mybutton(i)。点击,AddressOf mybutton_Click
AddHandler mybutton(i)。 MouseHover,AddressOf mybutton_Hoover
AddHandler mybutton(i).MouseLeave,AddressOf mybutton_Leave
start = start + 40
如果(i + 1)Mod 5 = 0那么
top = top + 20
start = 4
结束如果
下一页
结束Sub
Private Sub mybutton_Click _
(ByVal sender As Object,ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(发送者,按钮)
MessageBox.Show(" The day is:" &安培; thisbutton.Text)
End Sub
Private Sub mybutton_Hoover _
(ByVal sender As Object,ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender,Button)
thisbutton.BackColor = Drawing.Color.AliceBlue
End Sub
Private Sub mybutton_Leave _
(ByVal sender As Object,ByVal e As System.EventArgs)
Dim thisbutton作为Button = DirectCast(发件人,按钮)
thisbutton.BackColor = Drawing.Color.AntiqueWhite
End Sub
///
Hi,
I am trying to create form that displays data like an Access continuous
dataform rather than using a data grid.
I am thinking that I can achieve this by creating a row of text boxes, one
for each field I need to display. The creating a controls array for the
first n records I show and populate the text boxes. Then setting up a
vertical scroll bar for the number of records in the data table.
As the scroll bar is clicked or dragged, I will need to recreate the
controls array for each record/field.
Is there any easier way to achieve this result?
Thanks
Doug
Dough,
See this sample I once made, it looks in my opinion that it can help with
your question.
You will have to use textboxes of course instead of buttons.
I hope this helps?
Cor
\\\You can paste it directly in a created project code
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim start As Integer = 4
Dim top As Integer = 25
Dim i As Integer
Dim nowdate As DateTime = DateTime.Now
Dim mybutton(System.DateTime.DaysInMonth _
(nowdate.Year, nowdate.Month)) As Button
For i = 0 To System.DateTime.DaysInMonth _
(nowdate.Year, nowdate.Month) - 1
mybutton(i) = New Button
mybutton(i).TextAlign = ContentAlignment.MiddleCenter
mybutton(i).Width = 40
mybutton(i).Height = 20
mybutton(i).FlatStyle = FlatStyle.Flat
mybutton(i).BackColor = Drawing.Color.AntiqueWhite
mybutton(i).Location = New System.Drawing.Point(start, top)
mybutton(i).Text = (i + 1).ToString
mybutton(i).Cursor = Cursors.Hand
Me.Controls.Add(mybutton(i))
AddHandler mybutton(i).Click, AddressOf mybutton_Click
AddHandler mybutton(i).MouseHover, AddressOf mybutton_Hoover
AddHandler mybutton(i).MouseLeave, AddressOf mybutton_Leave
start = start + 40
If (i + 1) Mod 5 = 0 Then
top = top + 20
start = 4
End If
Next
End Sub
Private Sub mybutton_Click _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender, Button)
MessageBox.Show("The day is: " & thisbutton.Text)
End Sub
Private Sub mybutton_Hoover _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender, Button)
thisbutton.BackColor = Drawing.Color.AliceBlue
End Sub
Private Sub mybutton_Leave _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender, Button)
thisbutton.BackColor = Drawing.Color.AntiqueWhite
End Sub
///
Thanks Cor.
Is that the way you would tackle the requirement of creating an Access like
continuous form?
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...Dough,
See this sample I once made, it looks in my opinion that it can help with
your question.
You will have to use textboxes of course instead of buttons.
I hope this helps?
Cor
\\\You can paste it directly in a created project code
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim start As Integer = 4
Dim top As Integer = 25
Dim i As Integer
Dim nowdate As DateTime = DateTime.Now
Dim mybutton(System.DateTime.DaysInMonth _
(nowdate.Year, nowdate.Month)) As Button
For i = 0 To System.DateTime.DaysInMonth _
(nowdate.Year, nowdate.Month) - 1
mybutton(i) = New Button
mybutton(i).TextAlign = ContentAlignment.MiddleCenter
mybutton(i).Width = 40
mybutton(i).Height = 20
mybutton(i).FlatStyle = FlatStyle.Flat
mybutton(i).BackColor = Drawing.Color.AntiqueWhite
mybutton(i).Location = New System.Drawing.Point(start, top)
mybutton(i).Text = (i + 1).ToString
mybutton(i).Cursor = Cursors.Hand
Me.Controls.Add(mybutton(i))
AddHandler mybutton(i).Click, AddressOf mybutton_Click
AddHandler mybutton(i).MouseHover, AddressOf mybutton_Hoover
AddHandler mybutton(i).MouseLeave, AddressOf mybutton_Leave
start = start + 40
If (i + 1) Mod 5 = 0 Then
top = top + 20
start = 4
End If
Next
End Sub
Private Sub mybutton_Click _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender, Button)
MessageBox.Show("The day is: " & thisbutton.Text)
End Sub
Private Sub mybutton_Hoover _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender, Button)
thisbutton.BackColor = Drawing.Color.AliceBlue
End Sub
Private Sub mybutton_Leave _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender, Button)
thisbutton.BackColor = Drawing.Color.AntiqueWhite
End Sub
///
Doug,
Difficult to answer for me, because I do not know what is an Access like
continuous form.
However you wrote that you thought of building dynamicly textboxes and this
does the same.
Cor
"Doug Bell" <dug@bigpond>
...Thanks Cor.
Is that the way you would tackle the requirement of creating an Access
like
continuous form?
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...Dough,
See this sample I once made, it looks in my opinion that it can help with
your question.
You will have to use textboxes of course instead of buttons.
I hope this helps?
Cor
\\\You can paste it directly in a created project code
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim start As Integer = 4
Dim top As Integer = 25
Dim i As Integer
Dim nowdate As DateTime = DateTime.Now
Dim mybutton(System.DateTime.DaysInMonth _
(nowdate.Year, nowdate.Month)) As Button
For i = 0 To System.DateTime.DaysInMonth _
(nowdate.Year, nowdate.Month) - 1
mybutton(i) = New Button
mybutton(i).TextAlign = ContentAlignment.MiddleCenter
mybutton(i).Width = 40
mybutton(i).Height = 20
mybutton(i).FlatStyle = FlatStyle.Flat
mybutton(i).BackColor = Drawing.Color.AntiqueWhite
mybutton(i).Location = New System.Drawing.Point(start, top)
mybutton(i).Text = (i + 1).ToString
mybutton(i).Cursor = Cursors.Hand
Me.Controls.Add(mybutton(i))
AddHandler mybutton(i).Click, AddressOf mybutton_Click
AddHandler mybutton(i).MouseHover, AddressOf mybutton_Hoover
AddHandler mybutton(i).MouseLeave, AddressOf mybutton_Leave
start = start + 40
If (i + 1) Mod 5 = 0 Then
top = top + 20
start = 4
End If
Next
End Sub
Private Sub mybutton_Click _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender, Button)
MessageBox.Show("The day is: " & thisbutton.Text)
End Sub
Private Sub mybutton_Hoover _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender, Button)
thisbutton.BackColor = Drawing.Color.AliceBlue
End Sub
Private Sub mybutton_Leave _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim thisbutton As Button = DirectCast(sender, Button)
thisbutton.BackColor = Drawing.Color.AntiqueWhite
End Sub
///
这篇关于连续数据表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!