以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 代码求助! (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=130075) |
||||
-- 作者:rongping -- 发布时间:2019/1/12 11:46:00 -- 代码求助!
这段代码为什么非要添加一个Label13的控件, 怎样修改可以不加上这个多余的控件? |
||||
-- 作者:有点蓝 -- 发布时间:2019/1/12 12:07:00 -- Dim v As Integer = val(e.Sender.Text) Dim r() As String = {"命宫","兄弟","夫妻","子女","财帛","疾厄","迁移","仆役","官禄","田宅","福德","父母"} If r IsNot Nothing Dim idx As Integer = 1 If v >= 1 AndAlso v <= 12 Then For i As Integer = v-1 To 0 Step -1 e.Form.Controls("Label" & idx).text = r(i) idx += 1 Next For i As Integer = 11 To v Step -1 e.Form.Controls("Label" & idx).text = r(i) idx += 1 Next End If End If
|
||||
-- 作者:rongping -- 发布时间:2019/1/12 12:08:00 -- 谢谢 |
||||
-- 作者:rongping -- 发布时间:2019/1/12 18:09:00 -- 以下是引用有点蓝在2019/1/12 12:07:00的发言:
Dim v As Integer = val(e.Sender.Text)
Dim r() As String = {"命宫","兄弟","夫妻","子女","财帛","疾厄","迁移","仆役","官禄","田宅","福德","父母"}
If r IsNot Nothing
Dim idx As Integer = 1
If v >= 1 AndAlso v <= 12 Then
For i As Integer = v-1 To 0 Step -1
e.Form.Controls("Label" & idx).text = r(i)
idx += 1
Next
For i As Integer = 11 To v Step -1
e.Form.Controls("Label" & idx).text = r(i)
idx += 1
Next
End If
End If 再弱弱的问一下?如果是递增的模式该怎么改? |
||||
-- 作者:有点甜 -- 发布时间:2019/1/13 22:30:00 -- 以下是引用rongping在2019/1/12 18:09:00的发言:
再弱弱的问一下?如果是递增的模式该怎么改?
什么是【递增】模式?请截图或者举例说明。 |
||||
-- 作者:rongping -- 发布时间:2019/1/14 9:04:00 -- 这样怎么改写? |
||||
-- 作者:rongping -- 发布时间:2019/1/14 9:30:00 -- 此主题相关图片如下:捕获.png |
||||
-- 作者:有点甜 -- 发布时间:2019/1/14 9:48:00 --
什么意思?倒过来数的意思?逻辑是什么?
|
||||
-- 作者:rongping -- 发布时间:2019/1/14 10:08:00 -- 以第一个数组元素为基准,按照TextBox1中输入的数字赋值给相应的Label。比如数字是5,数组中的第一个元素就会赋值给Label5其余随后排序 |
||||
-- 作者:有点甜 -- 发布时间:2019/1/14 10:42:00 -- Dim v As Integer = val(e.Sender.Text) Dim r() As String = {"命宫","兄弟","夫妻","子女","财帛","疾厄","迁移","仆役","官禄","田宅","福德","父母"} If r IsNot Nothing If v >= 1 AndAlso v <= 12 Then For i As Integer = v To 12 e.Form.Controls("Label" & i).text = r(i-v) Next For i As Integer = 1 To v-1 e.Form.Controls("Label" & i).text = r(12-v+i) Next End If End If |