为DateTimePicker.Value赋值会影响其他类属性(VB.NET)

时间:2013-06-18 18:55:46

标签: vb.net datetimepicker

我有一行为我的表单Me.dateTimePickerAddStartDate.Value赋值 - 该值被正确分配,但它也会影响我的所有Me.checkBoxAddXXXXXX.Checked值,并将它们指定为TRUE。我无法理解为什么会发生这种情况 - 我做错了什么?

我刚刚添加了CType以确保它不是显式/隐式问题。

如果我把最后三行放在Me.checkBoxAddXXXXX.Checked作业之前,一切都按预期工作,但我不想掩盖一个问题,并发现它出现了一些意外的地方 - 我想解决根本问题。

Me.checkBoxAddMonday.Checked = m_Archiving.Time.Monday
Me.checkBoxAddTuesday.Checked = m_Archiving.Time.Tuesday
Me.checkBoxAddWednesday.Checked = m_Archiving.Time.Wednesday
Me.checkBoxAddThursday.Checked = m_Archiving.Time.Thursday
Me.checkBoxAddFriday.Checked = m_Archiving.Time.Friday
Me.checkBoxAddSaturday.Checked = m_Archiving.Time.Saturday
Me.checkBoxAddSunday.Checked = m_Archiving.Time.Sunday
Me.numericUpDownAddOffset.Value = CType(m_Archiving.Time.OffSet, System.Decimal)
Me.dateTimePickerAddStartDate.Value = CType(m_Archiving.Time.StartDate, System.DateTime)
Me.dateTimePickerAddStartTime.Value = CType(m_Archiving.Time.StartTime, System.DateTime)

0 个答案:

没有答案