473,226 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 software developers and data experts.

SelectedIndex Value Reported Incorrectly

I am writing a User Control that uses 3 DropDownLists. When I attempt to
access the SelectedIndex property it incorrectly reports the value selected
by the user. Why is this? Here is my code, thanks:
Public Class DatePicker
Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents ddlMonth As System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlDate As System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlYear As System.Web.UI.WebControls.DropDownList

'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region

Public Property SelectedDate() As Date
Get
Return CDate(ViewState("datevalue"))
End Get
Set(ByVal Value As Date)
ViewState("datevalue") = Value
ViewState("startyear") =
Math.Min(CDate(ViewState("datevalue")).Year, CInt(ViewState("startyear")))
ViewState("stopyear") =
Math.Max(CDate(ViewState("datevalue")).Year, CInt(ViewState("stopyear")))
Me.CreateLists()
End Set
End Property
Public Property FirstYear() As Integer
Get
Return CInt(ViewState("startyear"))
End Get
Set(ByVal Value As Integer)
If Value <= CDate(ViewState("datevalue")).Year AndAlso Value >=
1 Then
ViewState("startyear") = Value
Me.CreateLists()
End If
End Set
End Property
Public Property LastYear() As Integer
Get
Return CInt(ViewState("stopyear"))
End Get
Set(ByVal Value As Integer)
If Value >= CDate(ViewState("datevalue")).Year AndAlso Value <=
9999 Then
ViewState("stopyear") = Value
Me.CreateLists()
End If
End Set
End Property

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack() Then
ViewState.Add("datevalue", Date.Today)
ViewState.Add("startyear", 1950)
ViewState.Add("stopyear", 2050)
For i As Integer = 1 To 12
ddlMonth.Items.Add(New
ListItem(System.Globalization.DateTimeFormatInfo.C urrentInfo.GetMonthName(i),
CStr(i)))
Next
Me.CreateLists()
End If
End Sub

Private Sub CreateLists()
ddlYear.Items.Clear()
ddlDate.Items.Clear()
For j As Integer = CInt(ViewState("startyear")) To
CInt(ViewState("stopyear"))
ddlYear.Items.Add(CStr(j))
Next
For i As Integer = 1 To
Date.DaysInMonth(CDate(ViewState("datevalue")).Yea r,
CDate(ViewState("datevalue")).Month)
ddlDate.Items.Add(New ListItem(CStr(i) & " " &
System.Globalization.DateTimeFormatInfo.CurrentInf o.DayNames(New
Date(CDate(ViewState("datevalue")).Year,
CDate(ViewState("datevalue")).Month, i).DayOfWeek), CStr(i)))
Next
ddlMonth.SelectedIndex = CDate(ViewState("datevalue")).Month - 1
ddlYear.SelectedIndex = CDate(ViewState("datevalue")).Year -
CInt(ViewState("startyear"))
ddlDate.SelectedIndex = CDate(ViewState("datevalue")).Day - 1
End Sub

Private Sub DateChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ddlMonth.SelectedIndexChanged,
ddlYear.SelectedIndexChanged, ddlDate.SelectedIndexChanged
Dim selectedyear As Integer = ddlYear.SelectedIndex +
CInt(ViewState("startyear"))
Dim selectedmonth As Integer = ddlMonth.SelectedIndex + 1
Dim selectedday As Integer = ddlDate.SelectedIndex + 1
ViewState("datevalue") = New Date(selectedyear, selectedmonth,
Math.Min(Date.DaysInMonth(selectedyear, selectedmonth), selectedday))
Me.CreateLists()
End Sub
End Class


<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="DatePicker.ascx.vb" Inherits="WebApplication1.DatePicker"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:dropdownlist id="ddlMonth" AutoPostBack="True"
runat="server"></asp:dropdownlist>
<asp:dropdownlist id="ddlDate" AutoPostBack="True"
runat="server"></asp:dropdownlist>
<asp:dropdownlist id="ddlYear" AutoPostBack="True"
runat="server"></asp:dropdownlist>
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
6 1691
Hi Nathan,

Each time when page posts back, it reinitializes DropDownLists. Hence you
never get value from user selected.

HTH

Elton Wang

"Nathan Sokalski" wrote:
I am writing a User Control that uses 3 DropDownLists. When I attempt to
access the SelectedIndex property it incorrectly reports the value selected
by the user. Why is this? Here is my code, thanks:
Public Class DatePicker
Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents ddlMonth As System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlDate As System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlYear As System.Web.UI.WebControls.DropDownList

'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region

Public Property SelectedDate() As Date
Get
Return CDate(ViewState("datevalue"))
End Get
Set(ByVal Value As Date)
ViewState("datevalue") = Value
ViewState("startyear") =
Math.Min(CDate(ViewState("datevalue")).Year, CInt(ViewState("startyear")))
ViewState("stopyear") =
Math.Max(CDate(ViewState("datevalue")).Year, CInt(ViewState("stopyear")))
Me.CreateLists()
End Set
End Property
Public Property FirstYear() As Integer
Get
Return CInt(ViewState("startyear"))
End Get
Set(ByVal Value As Integer)
If Value <= CDate(ViewState("datevalue")).Year AndAlso Value >=
1 Then
ViewState("startyear") = Value
Me.CreateLists()
End If
End Set
End Property
Public Property LastYear() As Integer
Get
Return CInt(ViewState("stopyear"))
End Get
Set(ByVal Value As Integer)
If Value >= CDate(ViewState("datevalue")).Year AndAlso Value <=
9999 Then
ViewState("stopyear") = Value
Me.CreateLists()
End If
End Set
End Property

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack() Then
ViewState.Add("datevalue", Date.Today)
ViewState.Add("startyear", 1950)
ViewState.Add("stopyear", 2050)
For i As Integer = 1 To 12
ddlMonth.Items.Add(New
ListItem(System.Globalization.DateTimeFormatInfo.C urrentInfo.GetMonthName(i),
CStr(i)))
Next
Me.CreateLists()
End If
End Sub

Private Sub CreateLists()
ddlYear.Items.Clear()
ddlDate.Items.Clear()
For j As Integer = CInt(ViewState("startyear")) To
CInt(ViewState("stopyear"))
ddlYear.Items.Add(CStr(j))
Next
For i As Integer = 1 To
Date.DaysInMonth(CDate(ViewState("datevalue")).Yea r,
CDate(ViewState("datevalue")).Month)
ddlDate.Items.Add(New ListItem(CStr(i) & " " &
System.Globalization.DateTimeFormatInfo.CurrentInf o.DayNames(New
Date(CDate(ViewState("datevalue")).Year,
CDate(ViewState("datevalue")).Month, i).DayOfWeek), CStr(i)))
Next
ddlMonth.SelectedIndex = CDate(ViewState("datevalue")).Month - 1
ddlYear.SelectedIndex = CDate(ViewState("datevalue")).Year -
CInt(ViewState("startyear"))
ddlDate.SelectedIndex = CDate(ViewState("datevalue")).Day - 1
End Sub

Private Sub DateChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ddlMonth.SelectedIndexChanged,
ddlYear.SelectedIndexChanged, ddlDate.SelectedIndexChanged
Dim selectedyear As Integer = ddlYear.SelectedIndex +
CInt(ViewState("startyear"))
Dim selectedmonth As Integer = ddlMonth.SelectedIndex + 1
Dim selectedday As Integer = ddlDate.SelectedIndex + 1
ViewState("datevalue") = New Date(selectedyear, selectedmonth,
Math.Min(Date.DaysInMonth(selectedyear, selectedmonth), selectedday))
Me.CreateLists()
End Sub
End Class


<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="DatePicker.ascx.vb" Inherits="WebApplication1.DatePicker"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:dropdownlist id="ddlMonth" AutoPostBack="True"
runat="server"></asp:dropdownlist>
<asp:dropdownlist id="ddlDate" AutoPostBack="True"
runat="server"></asp:dropdownlist>
<asp:dropdownlist id="ddlYear" AutoPostBack="True"
runat="server"></asp:dropdownlist>
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #2
If you never get the value from the control, what is it's purpose? I know
there must be some way to get the SelectedIndex, I have done it plenty of
times in code I have written with pages, I am just having trouble doing it
with a User Control. The control was not invented just to look pretty, I
know there is some way to get the SelectedIndex.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Elton W" <El****@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
Hi Nathan,

Each time when page posts back, it reinitializes DropDownLists. Hence you
never get value from user selected.

HTH

Elton Wang

"Nathan Sokalski" wrote:
I am writing a User Control that uses 3 DropDownLists. When I attempt to
access the SelectedIndex property it incorrectly reports the value
selected
by the user. Why is this? Here is my code, thanks:
Public Class DatePicker
Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents ddlMonth As
System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlDate As
System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlYear As
System.Web.UI.WebControls.DropDownList

'NOTE: The following placeholder declaration is required by the Web
Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region

Public Property SelectedDate() As Date
Get
Return CDate(ViewState("datevalue"))
End Get
Set(ByVal Value As Date)
ViewState("datevalue") = Value
ViewState("startyear") =
Math.Min(CDate(ViewState("datevalue")).Year,
CInt(ViewState("startyear")))
ViewState("stopyear") =
Math.Max(CDate(ViewState("datevalue")).Year, CInt(ViewState("stopyear")))
Me.CreateLists()
End Set
End Property
Public Property FirstYear() As Integer
Get
Return CInt(ViewState("startyear"))
End Get
Set(ByVal Value As Integer)
If Value <= CDate(ViewState("datevalue")).Year AndAlso Value
>=

1 Then
ViewState("startyear") = Value
Me.CreateLists()
End If
End Set
End Property
Public Property LastYear() As Integer
Get
Return CInt(ViewState("stopyear"))
End Get
Set(ByVal Value As Integer)
If Value >= CDate(ViewState("datevalue")).Year AndAlso Value
<=
9999 Then
ViewState("stopyear") = Value
Me.CreateLists()
End If
End Set
End Property

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack() Then
ViewState.Add("datevalue", Date.Today)
ViewState.Add("startyear", 1950)
ViewState.Add("stopyear", 2050)
For i As Integer = 1 To 12
ddlMonth.Items.Add(New
ListItem(System.Globalization.DateTimeFormatInfo.C urrentInfo.GetMonthName(i),
CStr(i)))
Next
Me.CreateLists()
End If
End Sub

Private Sub CreateLists()
ddlYear.Items.Clear()
ddlDate.Items.Clear()
For j As Integer = CInt(ViewState("startyear")) To
CInt(ViewState("stopyear"))
ddlYear.Items.Add(CStr(j))
Next
For i As Integer = 1 To
Date.DaysInMonth(CDate(ViewState("datevalue")).Yea r,
CDate(ViewState("datevalue")).Month)
ddlDate.Items.Add(New ListItem(CStr(i) & " " &
System.Globalization.DateTimeFormatInfo.CurrentInf o.DayNames(New
Date(CDate(ViewState("datevalue")).Year,
CDate(ViewState("datevalue")).Month, i).DayOfWeek), CStr(i)))
Next
ddlMonth.SelectedIndex = CDate(ViewState("datevalue")).Month - 1
ddlYear.SelectedIndex = CDate(ViewState("datevalue")).Year -
CInt(ViewState("startyear"))
ddlDate.SelectedIndex = CDate(ViewState("datevalue")).Day - 1
End Sub

Private Sub DateChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ddlMonth.SelectedIndexChanged,
ddlYear.SelectedIndexChanged, ddlDate.SelectedIndexChanged
Dim selectedyear As Integer = ddlYear.SelectedIndex +
CInt(ViewState("startyear"))
Dim selectedmonth As Integer = ddlMonth.SelectedIndex + 1
Dim selectedday As Integer = ddlDate.SelectedIndex + 1
ViewState("datevalue") = New Date(selectedyear, selectedmonth,
Math.Min(Date.DaysInMonth(selectedyear, selectedmonth), selectedday))
Me.CreateLists()
End Sub
End Class


<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="DatePicker.ascx.vb" Inherits="WebApplication1.DatePicker"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:dropdownlist id="ddlMonth" AutoPostBack="True"
runat="server"></asp:dropdownlist>
<asp:dropdownlist id="ddlDate" AutoPostBack="True"
runat="server"></asp:dropdownlist>
<asp:dropdownlist id="ddlYear" AutoPostBack="True"
runat="server"></asp:dropdownlist>
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #3
The problem is, you're re-initializing the drop-downs with each Page_Load.

The Page_Load method is calling a method that re-initializes the Drop-down
lists, and sets their SelectedIndex to -1. You only need to re-initialize
them if their contents need to change. They have ViewState to persist their
state across PostBacks.

If you ever DO need to re-initialize them, you should get their
SelectedIndex FROM ViewState prior to re-initializing them, and set it back
(if necessary) afterwards. But there is no need to re-create their contents
with each PostBack.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Big things are made up of
lots of little things.

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
If you never get the value from the control, what is it's purpose? I know
there must be some way to get the SelectedIndex, I have done it plenty of
times in code I have written with pages, I am just having trouble doing it
with a User Control. The control was not invented just to look pretty, I
know there is some way to get the SelectedIndex.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Elton W" <El****@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
Hi Nathan,

Each time when page posts back, it reinitializes DropDownLists. Hence you
never get value from user selected.

HTH

Elton Wang

"Nathan Sokalski" wrote:
I am writing a User Control that uses 3 DropDownLists. When I attempt to
access the SelectedIndex property it incorrectly reports the value
selected
by the user. Why is this? Here is my code, thanks:
Public Class DatePicker
Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents ddlMonth As
System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlDate As
System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlYear As
System.Web.UI.WebControls.DropDownList

'NOTE: The following placeholder declaration is required by the Web
Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region

Public Property SelectedDate() As Date
Get
Return CDate(ViewState("datevalue"))
End Get
Set(ByVal Value As Date)
ViewState("datevalue") = Value
ViewState("startyear") =
Math.Min(CDate(ViewState("datevalue")).Year,
CInt(ViewState("startyear")))
ViewState("stopyear") =
Math.Max(CDate(ViewState("datevalue")).Year,
CInt(ViewState("stopyear")))
Me.CreateLists()
End Set
End Property
Public Property FirstYear() As Integer
Get
Return CInt(ViewState("startyear"))
End Get
Set(ByVal Value As Integer)
If Value <= CDate(ViewState("datevalue")).Year AndAlso Value
>=
1 Then
ViewState("startyear") = Value
Me.CreateLists()
End If
End Set
End Property
Public Property LastYear() As Integer
Get
Return CInt(ViewState("stopyear"))
End Get
Set(ByVal Value As Integer)
If Value >= CDate(ViewState("datevalue")).Year AndAlso Value
<=
9999 Then
ViewState("stopyear") = Value
Me.CreateLists()
End If
End Set
End Property

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack() Then
ViewState.Add("datevalue", Date.Today)
ViewState.Add("startyear", 1950)
ViewState.Add("stopyear", 2050)
For i As Integer = 1 To 12
ddlMonth.Items.Add(New
ListItem(System.Globalization.DateTimeFormatInfo.C urrentInfo.GetMonthName(i),
CStr(i)))
Next
Me.CreateLists()
End If
End Sub

Private Sub CreateLists()
ddlYear.Items.Clear()
ddlDate.Items.Clear()
For j As Integer = CInt(ViewState("startyear")) To
CInt(ViewState("stopyear"))
ddlYear.Items.Add(CStr(j))
Next
For i As Integer = 1 To
Date.DaysInMonth(CDate(ViewState("datevalue")).Yea r,
CDate(ViewState("datevalue")).Month)
ddlDate.Items.Add(New ListItem(CStr(i) & " " &
System.Globalization.DateTimeFormatInfo.CurrentInf o.DayNames(New
Date(CDate(ViewState("datevalue")).Year,
CDate(ViewState("datevalue")).Month, i).DayOfWeek), CStr(i)))
Next
ddlMonth.SelectedIndex = CDate(ViewState("datevalue")).Month - 1
ddlYear.SelectedIndex = CDate(ViewState("datevalue")).Year -
CInt(ViewState("startyear"))
ddlDate.SelectedIndex = CDate(ViewState("datevalue")).Day - 1
End Sub

Private Sub DateChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ddlMonth.SelectedIndexChanged,
ddlYear.SelectedIndexChanged, ddlDate.SelectedIndexChanged
Dim selectedyear As Integer = ddlYear.SelectedIndex +
CInt(ViewState("startyear"))
Dim selectedmonth As Integer = ddlMonth.SelectedIndex + 1
Dim selectedday As Integer = ddlDate.SelectedIndex + 1
ViewState("datevalue") = New Date(selectedyear, selectedmonth,
Math.Min(Date.DaysInMonth(selectedyear, selectedmonth), selectedday))
Me.CreateLists()
End Sub
End Class


<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="DatePicker.ascx.vb" Inherits="WebApplication1.DatePicker"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:dropdownlist id="ddlMonth" AutoPostBack="True"
runat="server"></asp:dropdownlist>
<asp:dropdownlist id="ddlDate" AutoPostBack="True"
runat="server"></asp:dropdownlist>
<asp:dropdownlist id="ddlYear" AutoPostBack="True"
runat="server"></asp:dropdownlist>
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/


Nov 19 '05 #4
What code do I have to remove to stop the reinitialization? I'm having
trouble figuring out where exactly the reinitialization is happening. I was
looking at a book recently, and it sounded a little to me (although I've
never written controls that store data before, so you'd know better than me)
like I might have to implement the IPostBackDataHandler.LoadPostData
function? However, all the examples I saw were with controls that only
contained one control, so I wouldn't know how to determine which of my DDLs
I was getting the data from. Is this implementation necessary for me to do,
or is what the DDLs I use sufficient and I just need to know how to avoid
the reinitialization? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OP*************@TK2MSFTNGP10.phx.gbl...
The problem is, you're re-initializing the drop-downs with each Page_Load.

The Page_Load method is calling a method that re-initializes the Drop-down
lists, and sets their SelectedIndex to -1. You only need to re-initialize
them if their contents need to change. They have ViewState to persist
their state across PostBacks.

If you ever DO need to re-initialize them, you should get their
SelectedIndex FROM ViewState prior to re-initializing them, and set it
back (if necessary) afterwards. But there is no need to re-create their
contents with each PostBack.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Big things are made up of
lots of little things.

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
If you never get the value from the control, what is it's purpose? I know
there must be some way to get the SelectedIndex, I have done it plenty of
times in code I have written with pages, I am just having trouble doing
it with a User Control. The control was not invented just to look pretty,
I know there is some way to get the SelectedIndex.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Elton W" <El****@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
Hi Nathan,

Each time when page posts back, it reinitializes DropDownLists. Hence
you
never get value from user selected.

HTH

Elton Wang

"Nathan Sokalski" wrote:

I am writing a User Control that uses 3 DropDownLists. When I attempt
to
access the SelectedIndex property it incorrectly reports the value
selected
by the user. Why is this? Here is my code, thanks:
Public Class DatePicker
Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents ddlMonth As
System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlDate As
System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlYear As
System.Web.UI.WebControls.DropDownList

'NOTE: The following placeholder declaration is required by the Web
Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region

Public Property SelectedDate() As Date
Get
Return CDate(ViewState("datevalue"))
End Get
Set(ByVal Value As Date)
ViewState("datevalue") = Value
ViewState("startyear") =
Math.Min(CDate(ViewState("datevalue")).Year,
CInt(ViewState("startyear")))
ViewState("stopyear") =
Math.Max(CDate(ViewState("datevalue")).Year,
CInt(ViewState("stopyear")))
Me.CreateLists()
End Set
End Property
Public Property FirstYear() As Integer
Get
Return CInt(ViewState("startyear"))
End Get
Set(ByVal Value As Integer)
If Value <= CDate(ViewState("datevalue")).Year AndAlso
Value >=
1 Then
ViewState("startyear") = Value
Me.CreateLists()
End If
End Set
End Property
Public Property LastYear() As Integer
Get
Return CInt(ViewState("stopyear"))
End Get
Set(ByVal Value As Integer)
If Value >= CDate(ViewState("datevalue")).Year AndAlso
Value <=
9999 Then
ViewState("stopyear") = Value
Me.CreateLists()
End If
End Set
End Property

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack() Then
ViewState.Add("datevalue", Date.Today)
ViewState.Add("startyear", 1950)
ViewState.Add("stopyear", 2050)
For i As Integer = 1 To 12
ddlMonth.Items.Add(New
ListItem(System.Globalization.DateTimeFormatInfo.C urrentInfo.GetMonthName(i),
CStr(i)))
Next
Me.CreateLists()
End If
End Sub

Private Sub CreateLists()
ddlYear.Items.Clear()
ddlDate.Items.Clear()
For j As Integer = CInt(ViewState("startyear")) To
CInt(ViewState("stopyear"))
ddlYear.Items.Add(CStr(j))
Next
For i As Integer = 1 To
Date.DaysInMonth(CDate(ViewState("datevalue")).Yea r,
CDate(ViewState("datevalue")).Month)
ddlDate.Items.Add(New ListItem(CStr(i) & " " &
System.Globalization.DateTimeFormatInfo.CurrentInf o.DayNames(New
Date(CDate(ViewState("datevalue")).Year,
CDate(ViewState("datevalue")).Month, i).DayOfWeek), CStr(i)))
Next
ddlMonth.SelectedIndex = CDate(ViewState("datevalue")).Month -
1
ddlYear.SelectedIndex = CDate(ViewState("datevalue")).Year -
CInt(ViewState("startyear"))
ddlDate.SelectedIndex = CDate(ViewState("datevalue")).Day - 1
End Sub

Private Sub DateChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ddlMonth.SelectedIndexChanged,
ddlYear.SelectedIndexChanged, ddlDate.SelectedIndexChanged
Dim selectedyear As Integer = ddlYear.SelectedIndex +
CInt(ViewState("startyear"))
Dim selectedmonth As Integer = ddlMonth.SelectedIndex + 1
Dim selectedday As Integer = ddlDate.SelectedIndex + 1
ViewState("datevalue") = New Date(selectedyear, selectedmonth,
Math.Min(Date.DaysInMonth(selectedyear, selectedmonth), selectedday))
Me.CreateLists()
End Sub
End Class


<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="DatePicker.ascx.vb" Inherits="WebApplication1.DatePicker"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:dropdownlist id="ddlMonth" AutoPostBack="True"
runat="server"></asp:dropdownlist>
<asp:dropdownlist id="ddlDate" AutoPostBack="True"
runat="server"></asp:dropdownlist>
<asp:dropdownlist id="ddlYear" AutoPostBack="True"
runat="server"></asp:dropdownlist>
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/



Nov 19 '05 #5
Hi Nathan,

Actually I was wrong. You did have:

If Not IsPostback Then

CreateLists

to initialize ddls only in the first loading.

What I can suggest is you put breakpoints in both Page_Load and data process
methods and put SelectedIndex in watch winder. Then run it step by step to
see what happens. Since ddls are in an usercontrol, there is maybe something
unusual.

HTH

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:uX**************@TK2MSFTNGP14.phx.gbl...
What code do I have to remove to stop the reinitialization? I'm having
trouble figuring out where exactly the reinitialization is happening. I
was looking at a book recently, and it sounded a little to me (although
I've never written controls that store data before, so you'd know better
than me) like I might have to implement the
IPostBackDataHandler.LoadPostData function? However, all the examples I
saw were with controls that only contained one control, so I wouldn't know
how to determine which of my DDLs I was getting the data from. Is this
implementation necessary for me to do, or is what the DDLs I use
sufficient and I just need to know how to avoid the reinitialization?
Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OP*************@TK2MSFTNGP10.phx.gbl...
The problem is, you're re-initializing the drop-downs with each
Page_Load.

The Page_Load method is calling a method that re-initializes the
Drop-down lists, and sets their SelectedIndex to -1. You only need to
re-initialize them if their contents need to change. They have ViewState
to persist their state across PostBacks.

If you ever DO need to re-initialize them, you should get their
SelectedIndex FROM ViewState prior to re-initializing them, and set it
back (if necessary) afterwards. But there is no need to re-create their
contents with each PostBack.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Big things are made up of
lots of little things.

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
If you never get the value from the control, what is it's purpose? I
know there must be some way to get the SelectedIndex, I have done it
plenty of times in code I have written with pages, I am just having
trouble doing it with a User Control. The control was not invented just
to look pretty, I know there is some way to get the SelectedIndex.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Elton W" <El****@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
Hi Nathan,

Each time when page posts back, it reinitializes DropDownLists. Hence
you
never get value from user selected.

HTH

Elton Wang

"Nathan Sokalski" wrote:

> I am writing a User Control that uses 3 DropDownLists. When I attempt
> to
> access the SelectedIndex property it incorrectly reports the value
> selected
> by the user. Why is this? Here is my code, thanks:
>
>
> Public Class DatePicker
> Inherits System.Web.UI.UserControl
>
> #Region " Web Form Designer Generated Code "
>
> 'This call is required by the Web Form Designer.
> <System.Diagnostics.DebuggerStepThrough()> Private Sub
> InitializeComponent()
> End Sub
> Protected WithEvents ddlMonth As
> System.Web.UI.WebControls.DropDownList
> Protected WithEvents ddlDate As
> System.Web.UI.WebControls.DropDownList
> Protected WithEvents ddlYear As
> System.Web.UI.WebControls.DropDownList
>
> 'NOTE: The following placeholder declaration is required by the
> Web Form
> Designer.
> 'Do not delete or move it.
> Private designerPlaceholderDeclaration As System.Object
>
> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Init
> 'CODEGEN: This method call is required by the Web Form
> Designer
> 'Do not modify it using the code editor.
> InitializeComponent()
> End Sub
> #End Region
>
> Public Property SelectedDate() As Date
> Get
> Return CDate(ViewState("datevalue"))
> End Get
> Set(ByVal Value As Date)
> ViewState("datevalue") = Value
> ViewState("startyear") =
> Math.Min(CDate(ViewState("datevalue")).Year,
> CInt(ViewState("startyear")))
> ViewState("stopyear") =
> Math.Max(CDate(ViewState("datevalue")).Year,
> CInt(ViewState("stopyear")))
> Me.CreateLists()
> End Set
> End Property
> Public Property FirstYear() As Integer
> Get
> Return CInt(ViewState("startyear"))
> End Get
> Set(ByVal Value As Integer)
> If Value <= CDate(ViewState("datevalue")).Year AndAlso
> Value >=
> 1 Then
> ViewState("startyear") = Value
> Me.CreateLists()
> End If
> End Set
> End Property
> Public Property LastYear() As Integer
> Get
> Return CInt(ViewState("stopyear"))
> End Get
> Set(ByVal Value As Integer)
> If Value >= CDate(ViewState("datevalue")).Year AndAlso
> Value <=
> 9999 Then
> ViewState("stopyear") = Value
> Me.CreateLists()
> End If
> End Set
> End Property
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> If Not IsPostBack() Then
> ViewState.Add("datevalue", Date.Today)
> ViewState.Add("startyear", 1950)
> ViewState.Add("stopyear", 2050)
> For i As Integer = 1 To 12
> ddlMonth.Items.Add(New
> ListItem(System.Globalization.DateTimeFormatInfo.C urrentInfo.GetMonthName(i),
> CStr(i)))
> Next
> Me.CreateLists()
> End If
> End Sub
>
> Private Sub CreateLists()
> ddlYear.Items.Clear()
> ddlDate.Items.Clear()
> For j As Integer = CInt(ViewState("startyear")) To
> CInt(ViewState("stopyear"))
> ddlYear.Items.Add(CStr(j))
> Next
> For i As Integer = 1 To
> Date.DaysInMonth(CDate(ViewState("datevalue")).Yea r,
> CDate(ViewState("datevalue")).Month)
> ddlDate.Items.Add(New ListItem(CStr(i) & " " &
> System.Globalization.DateTimeFormatInfo.CurrentInf o.DayNames(New
> Date(CDate(ViewState("datevalue")).Year,
> CDate(ViewState("datevalue")).Month, i).DayOfWeek), CStr(i)))
> Next
> ddlMonth.SelectedIndex = CDate(ViewState("datevalue")).Month -
> 1
> ddlYear.SelectedIndex = CDate(ViewState("datevalue")).Year -
> CInt(ViewState("startyear"))
> ddlDate.SelectedIndex = CDate(ViewState("datevalue")).Day - 1
> End Sub
>
> Private Sub DateChanged(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles ddlMonth.SelectedIndexChanged,
> ddlYear.SelectedIndexChanged, ddlDate.SelectedIndexChanged
> Dim selectedyear As Integer = ddlYear.SelectedIndex +
> CInt(ViewState("startyear"))
> Dim selectedmonth As Integer = ddlMonth.SelectedIndex + 1
> Dim selectedday As Integer = ddlDate.SelectedIndex + 1
> ViewState("datevalue") = New Date(selectedyear, selectedmonth,
> Math.Min(Date.DaysInMonth(selectedyear, selectedmonth), selectedday))
> Me.CreateLists()
> End Sub
> End Class
>
>
>
>
> <%@ Control Language="vb" AutoEventWireup="false"
> Codebehind="DatePicker.ascx.vb" Inherits="WebApplication1.DatePicker"
> TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
> <asp:dropdownlist id="ddlMonth" AutoPostBack="True"
> runat="server"></asp:dropdownlist>
> <asp:dropdownlist id="ddlDate" AutoPostBack="True"
> runat="server"></asp:dropdownlist>
> <asp:dropdownlist id="ddlYear" AutoPostBack="True"
> runat="server"></asp:dropdownlist>
> --
> Nathan Sokalski
> nj********@hotmail.com
> http://www.nathansokalski.com/
>
>
>



Nov 19 '05 #6
I think that did help. I propably overused some of the information I kept in
the Control. The problem was in the Set accessor functions for FirstYear and
LastYear when they called CreateLists(), once I removed them and changed one
place to using SelectedValue converted to an integer rather than calculating
from the SelectedIndex, I think it's good now. I think I never anticipated
before how often the accessor functions are called. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Elton Wang" <el********@hotmail.com> wrote in message
news:eF**************@TK2MSFTNGP09.phx.gbl...
Hi Nathan,

Actually I was wrong. You did have:

If Not IsPostback Then

CreateLists

to initialize ddls only in the first loading.

What I can suggest is you put breakpoints in both Page_Load and data
process methods and put SelectedIndex in watch winder. Then run it step by
step to see what happens. Since ddls are in an usercontrol, there is maybe
something unusual.

HTH

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:uX**************@TK2MSFTNGP14.phx.gbl...
What code do I have to remove to stop the reinitialization? I'm having
trouble figuring out where exactly the reinitialization is happening. I
was looking at a book recently, and it sounded a little to me (although
I've never written controls that store data before, so you'd know better
than me) like I might have to implement the
IPostBackDataHandler.LoadPostData function? However, all the examples I
saw were with controls that only contained one control, so I wouldn't
know how to determine which of my DDLs I was getting the data from. Is
this implementation necessary for me to do, or is what the DDLs I use
sufficient and I just need to know how to avoid the reinitialization?
Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OP*************@TK2MSFTNGP10.phx.gbl...
The problem is, you're re-initializing the drop-downs with each
Page_Load.

The Page_Load method is calling a method that re-initializes the
Drop-down lists, and sets their SelectedIndex to -1. You only need to
re-initialize them if their contents need to change. They have ViewState
to persist their state across PostBacks.

If you ever DO need to re-initialize them, you should get their
SelectedIndex FROM ViewState prior to re-initializing them, and set it
back (if necessary) afterwards. But there is no need to re-create their
contents with each PostBack.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Big things are made up of
lots of little things.

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
If you never get the value from the control, what is it's purpose? I
know there must be some way to get the SelectedIndex, I have done it
plenty of times in code I have written with pages, I am just having
trouble doing it with a User Control. The control was not invented just
to look pretty, I know there is some way to get the SelectedIndex.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Elton W" <El****@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
> Hi Nathan,
>
> Each time when page posts back, it reinitializes DropDownLists. Hence
> you
> never get value from user selected.
>
> HTH
>
> Elton Wang
>
> "Nathan Sokalski" wrote:
>
>> I am writing a User Control that uses 3 DropDownLists. When I attempt
>> to
>> access the SelectedIndex property it incorrectly reports the value
>> selected
>> by the user. Why is this? Here is my code, thanks:
>>
>>
>> Public Class DatePicker
>> Inherits System.Web.UI.UserControl
>>
>> #Region " Web Form Designer Generated Code "
>>
>> 'This call is required by the Web Form Designer.
>> <System.Diagnostics.DebuggerStepThrough()> Private Sub
>> InitializeComponent()
>> End Sub
>> Protected WithEvents ddlMonth As
>> System.Web.UI.WebControls.DropDownList
>> Protected WithEvents ddlDate As
>> System.Web.UI.WebControls.DropDownList
>> Protected WithEvents ddlYear As
>> System.Web.UI.WebControls.DropDownList
>>
>> 'NOTE: The following placeholder declaration is required by the
>> Web Form
>> Designer.
>> 'Do not delete or move it.
>> Private designerPlaceholderDeclaration As System.Object
>>
>> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
>> System.EventArgs) Handles MyBase.Init
>> 'CODEGEN: This method call is required by the Web Form
>> Designer
>> 'Do not modify it using the code editor.
>> InitializeComponent()
>> End Sub
>> #End Region
>>
>> Public Property SelectedDate() As Date
>> Get
>> Return CDate(ViewState("datevalue"))
>> End Get
>> Set(ByVal Value As Date)
>> ViewState("datevalue") = Value
>> ViewState("startyear") =
>> Math.Min(CDate(ViewState("datevalue")).Year,
>> CInt(ViewState("startyear")))
>> ViewState("stopyear") =
>> Math.Max(CDate(ViewState("datevalue")).Year,
>> CInt(ViewState("stopyear")))
>> Me.CreateLists()
>> End Set
>> End Property
>> Public Property FirstYear() As Integer
>> Get
>> Return CInt(ViewState("startyear"))
>> End Get
>> Set(ByVal Value As Integer)
>> If Value <= CDate(ViewState("datevalue")).Year AndAlso
>> Value >=
>> 1 Then
>> ViewState("startyear") = Value
>> Me.CreateLists()
>> End If
>> End Set
>> End Property
>> Public Property LastYear() As Integer
>> Get
>> Return CInt(ViewState("stopyear"))
>> End Get
>> Set(ByVal Value As Integer)
>> If Value >= CDate(ViewState("datevalue")).Year AndAlso
>> Value <=
>> 9999 Then
>> ViewState("stopyear") = Value
>> Me.CreateLists()
>> End If
>> End Set
>> End Property
>>
>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
>> System.EventArgs) Handles MyBase.Load
>> If Not IsPostBack() Then
>> ViewState.Add("datevalue", Date.Today)
>> ViewState.Add("startyear", 1950)
>> ViewState.Add("stopyear", 2050)
>> For i As Integer = 1 To 12
>> ddlMonth.Items.Add(New
>> ListItem(System.Globalization.DateTimeFormatInfo.C urrentInfo.GetMonthName(i),
>> CStr(i)))
>> Next
>> Me.CreateLists()
>> End If
>> End Sub
>>
>> Private Sub CreateLists()
>> ddlYear.Items.Clear()
>> ddlDate.Items.Clear()
>> For j As Integer = CInt(ViewState("startyear")) To
>> CInt(ViewState("stopyear"))
>> ddlYear.Items.Add(CStr(j))
>> Next
>> For i As Integer = 1 To
>> Date.DaysInMonth(CDate(ViewState("datevalue")).Yea r,
>> CDate(ViewState("datevalue")).Month)
>> ddlDate.Items.Add(New ListItem(CStr(i) & " " &
>> System.Globalization.DateTimeFormatInfo.CurrentInf o.DayNames(New
>> Date(CDate(ViewState("datevalue")).Year,
>> CDate(ViewState("datevalue")).Month, i).DayOfWeek), CStr(i)))
>> Next
>> ddlMonth.SelectedIndex =
>> CDate(ViewState("datevalue")).Month - 1
>> ddlYear.SelectedIndex = CDate(ViewState("datevalue")).Year -
>> CInt(ViewState("startyear"))
>> ddlDate.SelectedIndex = CDate(ViewState("datevalue")).Day - 1
>> End Sub
>>
>> Private Sub DateChanged(ByVal sender As Object, ByVal e As
>> System.EventArgs) Handles ddlMonth.SelectedIndexChanged,
>> ddlYear.SelectedIndexChanged, ddlDate.SelectedIndexChanged
>> Dim selectedyear As Integer = ddlYear.SelectedIndex +
>> CInt(ViewState("startyear"))
>> Dim selectedmonth As Integer = ddlMonth.SelectedIndex + 1
>> Dim selectedday As Integer = ddlDate.SelectedIndex + 1
>> ViewState("datevalue") = New Date(selectedyear,
>> selectedmonth,
>> Math.Min(Date.DaysInMonth(selectedyear, selectedmonth), selectedday))
>> Me.CreateLists()
>> End Sub
>> End Class
>>
>>
>>
>>
>> <%@ Control Language="vb" AutoEventWireup="false"
>> Codebehind="DatePicker.ascx.vb" Inherits="WebApplication1.DatePicker"
>> TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
>> <asp:dropdownlist id="ddlMonth" AutoPostBack="True"
>> runat="server"></asp:dropdownlist>
>> <asp:dropdownlist id="ddlDate" AutoPostBack="True"
>> runat="server"></asp:dropdownlist>
>> <asp:dropdownlist id="ddlYear" AutoPostBack="True"
>> runat="server"></asp:dropdownlist>
>> --
>> Nathan Sokalski
>> nj********@hotmail.com
>> http://www.nathansokalski.com/
>>
>>
>>



Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
3
by: % =joe % | last post by:
I cannot get this code to work. Very simple...I have three list menus. I want to do a check before the form submits to make sure that the value of the 3 fields is equal to 12. Here's my...
2
by: ross kerr | last post by:
Hi all, I have a control that extends the ComboBox object. It updates the selected item based on what the user enters in the text area. In the OnLeave event of the combobox, the selected...
3
by: Angel | last post by:
I have a problem I placed a DropDown list control on my .NET page. I do not want to perform a postback when something is selected. When I want to get what was selected in the Client Script I do not...
3
by: Nathan Sokalski | last post by:
I am working on a simple user control composed of 3 DropDownLists that will be used to select Dates. The purpose of the control is to all the user to choose a date using dropdown lists but not need...
1
by: Nathan Sokalski | last post by:
I have a problem that is driving me crazy. I have a User Control composed of three DropDownLists that will be used to select a date. I have everything working except for one thing. When I select a...
12
by: Steve Dyte | last post by:
Hi, I've narrowed down a problem I've been having filling a combobox with the results of a query stored in a datatable. I'm setting the ValueMember and DisplayMember to the relevant column...
18
by: Academia | last post by:
I let the use modify the text of a combobox and then I replace the selected item with the new text (in Keyup event). But if he sets the Text property to an empty string ("") that sets the...
20
by: teddysnips | last post by:
Weird. I have taken over responsibility for a legacy application, Access 2k3, split FE/BE. The client has reported a problem and I'm investigating. I didn't write the application. The...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.