类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
我想把一个按钮传进去该怎么写?比如把command1传进去.
public sub Button_Color()
txtSQL = "select * from office_building_state where building_id=102"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
building_start = mrc.Fields(3)
If building_start = 1 Then
Room102.BackColor = &HFF&
Else
If building_start = 2 Then
Room102.BackColor = &HFF00FF
Else
If building_start = 3 Then
Room102.BackColor = &HFF00&
End If
End If
End If
End If
mrc.MoveNext
mrc.Close
end sub
网友回答:
hhjjhjhj(大头)(想变胡萝卜^^) 的方法是对的
至于真么调用,
假如按钮控件的名字是 cmd1
这样调用
Button_Color cmd1
或
call Button_Color(cmd1)
楼主的意思是不是将COMMAND1的某项属性传过去啊?
另外,提一个建议:
楼主的这段代码
building_start = mrc.Fields(3)
If building_start = 1 Then
Room102.BackColor = &HFF&
Else
If building_start = 2 Then
Room102.BackColor = &HFF00FF
Else
If building_start = 3 Then
Room102.BackColor = &HFF00&
End If
End If
End If
改用SELECT CASE 语句会更好一些!