[.NET] 再問~~Property的問題~
各位大大好~我又來問問題了 冏~~z
先說我想做些什麼好了
就如上篇所問的 我把我webform中的東西 全部用一個object陣列包起來
想要傳到user control去做一些處理
感謝大大的回答 我可以順利的找出陣列中原本的東西
但現在又面臨到一個問題 要怎麼把原本在webform中的陣列傳到user control中
以我的理解好像是可以用session或是property來做
我選擇了用property來實作
以下是我在user control中寫的
=====================================================
Property sendComponents() As Object()
Get
Return Me.ViewState("sendComponents")
End Get
Set(ByVal Value As Object())
Me.ViewState("sendComponents") = Value
Me.rcvComponents = sendComponents
End Set
End Property
=====================================================
我在webform中寫了以下幾行程式想要傳遞陣列過去
=====================================================
Dim Mycontrol As WebUserControl11
Mycontrol = Me.FindControl("WebUserControl1")
Mycontrol.sendComponents = allComponent
=====================================================
可是卻會發生"並未將物件參考設定為物件的執行個體"的錯誤
以在下的理解是
Dim allComponent() As Object = {Me.TextBox1, Me.TextBox2, Me.CheckBox1,
Me.CheckBox2, Me.DropDownList1, Me.TextBox3}
這個部份的allComponent是一個物件參考變數 分別指向textbox1,textbox2等等~
但是並沒有真的的生出實體來
可是我就卡在這個地方不知道該怎麼做才好
又要麻煩大大們囉
文章有些長 先感謝大家耐心的看完~~
拜託各位囉~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.132.182.104
推
10/15 10:36, , 1F
10/15 10:36, 1F
推
10/15 11:09, , 2F
10/15 11:09, 2F
推
10/15 14:22, , 3F
10/15 14:22, 3F
→
10/15 14:22, , 4F
10/15 14:22, 4F
推
10/15 14:25, , 5F
10/15 14:25, 5F
推
10/15 14:44, , 6F
10/15 14:44, 6F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章