









Using the COM+ Shared Property Manager with Visual Basic 6: Caching Data in the Middle-Tier
et’s face it. Caching is a fancy was of saying that you are going to save some type of data somewhere. In the n-tier web application model, your tiers are
et’s face it. Caching is a fancy was of saying that you are going to save some type of data somewhere. In the n-tier web application model, your tiers are
‘ Find a control in a hierarchy of controls’ Example:’ Dim txtCtl As Control = FindControlRecursive(DataGrid1, “FirstNameTextBox”)Function FindControlRecursive(ByVal ctrl As Control, _ ByVal id As String) As Control ‘ Exit
‘ Return the index in a ListControl given a value’ Example:’ Dim i As Integer = GetIndexFromText(ListBox1, “hellovalue”)Function GetIndexFromValue(ByVal lst As ListControl, ByVal value As String) As _ Integer Return
‘ Select the ListControl element with a given text’ Example: SelectItemFromText(ListBox1, “hello”)Sub SelectItemFromText(ByVal lst As ListControl, ByVal value As String) lst.SelectedIndex = lst.Items.IndexOf(lst.Items.FindByText(value))End Sub
‘ Return the index in a ListControl given a text’ Example:’ Dim i As Integer = GetIndexFromText(ListBox1, “hello”)Function GetIndexFromText(ByVal lst As ListControl, ByVal value As String) As _ Integer Return
‘ EvalFileName ensures that the basename of a file or directory’ conforms to the Microsoft file naming guidelines (see MSDN webpage)’ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/’ naming_a_file.asp” Return value:’ True = Valid basename’ False
The VB’s MkDir function creates a directory in a specified path. If the directory already exists, MkDir raises error 75 (Path/file access error); yet, it raises the same error code
‘ Select the ListControl element with a given value’ Example: SelectItemFromValue(ListBox1, “hellovalue”)Sub SelectItemFromValue(ByVal lst As ListControl, ByVal value As String) lst.SelectedIndex = lst.Items.IndexOf(lst.Items.FindByValue(value))End Sub
Being an avid Access Programmer I have been frustrated with the limitation of VB DropDownLists to using only 1 field as the value. I found a way to simulate/work around