473,395 Members | 1,458 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,395 software developers and data experts.

Q: Why this not work ?

This is just me testing, however the two top sub's are
never called........why ?.

Where is the error of my ways?

Sub ProcessLogo(ByVal sender As Object, ByVal e As
CommandEventArgs)
Dim Test As Object = e.CommandArgument
End Sub

Sub ProcessLogo_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim Test As Object = CType(sender,
Button).CommandName
End Sub

Function BuildLogoTable()
'// Get logo definitions and put them in the table
Dim ThisPage As String = "AddCompany"
Dim Language As String = Session.Contents("LLC")
Try
Dim PreviewFilePointer As String = ""
Dim BuildLogoCommand As SqlCommand
Dim BuildLogoReader As SqlDataReader
Dim BuildLogoConnection As SqlConnection =
New SqlConnection(ConfigurationSettings.AppSettings
("Publimation_Authorisation"))
BuildLogoCommand = New SqlCommand
("GetImageDataByCatagory", BuildLogoConnection)
BuildLogoCommand.CommandType =
CommandType.StoredProcedure
BuildLogoCommand.Parameters.Add("@projectid",
SqlDbType.Int, 4).Value = Session.Contents("PID")
BuildLogoCommand.Parameters.Add
("@imagecatagory", SqlDbType.Int, 4).Value = 1
BuildLogoConnection.Open()
BuildLogoReader =
BuildLogoCommand.ExecuteReader
Dim LogoRow As New TableRow()
Dim LogoSelectRow As New TableRow()
While BuildLogoReader.Read
Dim LogoID As Integer =
BuildLogoReader.GetInt32(0)
Dim LogoImage As String =
BuildLogoReader.GetString(8) & BuildLogoReader.GetString
(4) & "." & BuildLogoReader.GetString(7)
Dim LogoLocation As String =
ConfigurationSettings.AppSettings("ProjectVirtualR oot")
& "/domains/" & Session.Contents("PSN") & Trim(Replace
(LogoImage, "\", "/"))
Dim LogoCell As New TableCell()
Dim LogoSelectCell As New TableCell()
Dim SelectButton As New LinkButton()
SelectButton.Text =
GetLanguageArray.GetText(ThisPage, Language,
LanguageArray, "Select")
SelectButton.CommandArgument = LogoID
AddHandler SelectButton.Command,
AddressOf ProcessLogo
AddHandler SelectButton.Click, AddressOf
ProcessLogo_Click
LogoCell.Text = "<img src=""" &
LogoLocation & """>"
LogoSelectCell.Controls.Add(SelectButton)
LogoRow.Cells.Add(LogoCell)
LogoSelectRow.Cells.Add(LogoSelectCell)
End While
TableLogo.Rows.Add(LogoRow)
TableLogo.Rows.Add(LogoSelectRow)
BuildLogoReader.Close()
BuildLogoConnection.Close()
Catch x As Exception
ErrorLogger.ErrorManager
("BuildCompanyLogoTableError", x)
End Try
End Function
Jul 19 '05 #1
6 1503
How are you "calling them", and how do you know they are now being called?

Cheers
Ken
"Harold" <st*****@hotmail.com> wrote in message
news:12****************************@phx.gbl...
: This is just me testing, however the two top sub's are
: never called........why ?.
:
: Where is the error of my ways?
:
: Sub ProcessLogo(ByVal sender As Object, ByVal e As
: CommandEventArgs)
: Dim Test As Object = e.CommandArgument
: End Sub
:
: Sub ProcessLogo_Click(ByVal sender As Object, ByVal e As
: System.EventArgs)
: Dim Test As Object = CType(sender,
: Button).CommandName
: End Sub
:
: Function BuildLogoTable()
: '// Get logo definitions and put them in the table
: Dim ThisPage As String = "AddCompany"
: Dim Language As String = Session.Contents("LLC")
: Try
: Dim PreviewFilePointer As String = ""
: Dim BuildLogoCommand As SqlCommand
: Dim BuildLogoReader As SqlDataReader
: Dim BuildLogoConnection As SqlConnection =
: New SqlConnection(ConfigurationSettings.AppSettings
: ("Publimation_Authorisation"))
: BuildLogoCommand = New SqlCommand
: ("GetImageDataByCatagory", BuildLogoConnection)
: BuildLogoCommand.CommandType =
: CommandType.StoredProcedure
: BuildLogoCommand.Parameters.Add("@projectid",
: SqlDbType.Int, 4).Value = Session.Contents("PID")
: BuildLogoCommand.Parameters.Add
: ("@imagecatagory", SqlDbType.Int, 4).Value = 1
: BuildLogoConnection.Open()
: BuildLogoReader =
: BuildLogoCommand.ExecuteReader
: Dim LogoRow As New TableRow()
: Dim LogoSelectRow As New TableRow()
: While BuildLogoReader.Read
: Dim LogoID As Integer =
: BuildLogoReader.GetInt32(0)
: Dim LogoImage As String =
: BuildLogoReader.GetString(8) & BuildLogoReader.GetString
: (4) & "." & BuildLogoReader.GetString(7)
: Dim LogoLocation As String =
: ConfigurationSettings.AppSettings("ProjectVirtualR oot")
: & "/domains/" & Session.Contents("PSN") & Trim(Replace
: (LogoImage, "\", "/"))
: Dim LogoCell As New TableCell()
: Dim LogoSelectCell As New TableCell()
: Dim SelectButton As New LinkButton()
: SelectButton.Text =
: GetLanguageArray.GetText(ThisPage, Language,
: LanguageArray, "Select")
: SelectButton.CommandArgument = LogoID
: AddHandler SelectButton.Command,
: AddressOf ProcessLogo
: AddHandler SelectButton.Click, AddressOf
: ProcessLogo_Click
: LogoCell.Text = "<img src=""" &
: LogoLocation & """>"
: LogoSelectCell.Controls.Add(SelectButton)
: LogoRow.Cells.Add(LogoCell)
: LogoSelectRow.Cells.Add(LogoSelectCell)
: End While
: TableLogo.Rows.Add(LogoRow)
: TableLogo.Rows.Add(LogoSelectRow)
: BuildLogoReader.Close()
: BuildLogoConnection.Close()
: Catch x As Exception
: ErrorLogger.ErrorManager
: ("BuildCompanyLogoTableError", x)
: End Try
: End Function
Jul 19 '05 #2
Hi there, and thanks for the interest,

Firstly by adding a "dymanic" eventhander as needed
(depending on the amount of items returned)

"AddHandler SelectButton.Command, AddressOf ProcessLogo"
(see in code)
Here it should link the button action to the
subroutine "ProcessLogo". So if the button has a command
(event) it should be handled by the subroutine.

But it isn't. It's pretty to check, just put the routine
in debug mode and put a break on the first best code line
in the subroutine, then you will see the routine is never
called. It is as if the handler is ignored.

Any Ideas ?

Thanks in advance.
Harold.
-----Original Message-----
How are you "calling them", and how do you know they are now being called?
Cheers
Ken
"Harold" <st*****@hotmail.com> wrote in message
news:12****************************@phx.gbl...
: This is just me testing, however the two top sub's are
: never called........why ?.
:
: Where is the error of my ways?
:
: Sub ProcessLogo(ByVal sender As Object, ByVal e As
: CommandEventArgs)
: Dim Test As Object = e.CommandArgument
: End Sub
:
: Sub ProcessLogo_Click(ByVal sender As Object, ByVal e As: System.EventArgs)
: Dim Test As Object = CType(sender,
: Button).CommandName
: End Sub
:
: Function BuildLogoTable()
: '// Get logo definitions and put them in the table: Dim ThisPage As String = "AddCompany"
: Dim Language As String = Session.Contents ("LLC"): Try
: Dim PreviewFilePointer As String = ""
: Dim BuildLogoCommand As SqlCommand
: Dim BuildLogoReader As SqlDataReader
: Dim BuildLogoConnection As SqlConnection =
: New SqlConnection(ConfigurationSettings.AppSettings
: ("Publimation_Authorisation"))
: BuildLogoCommand = New SqlCommand
: ("GetImageDataByCatagory", BuildLogoConnection)
: BuildLogoCommand.CommandType =
: CommandType.StoredProcedure
: BuildLogoCommand.Parameters.Add ("@projectid",: SqlDbType.Int, 4).Value = Session.Contents("PID")
: BuildLogoCommand.Parameters.Add
: ("@imagecatagory", SqlDbType.Int, 4).Value = 1
: BuildLogoConnection.Open()
: BuildLogoReader =
: BuildLogoCommand.ExecuteReader
: Dim LogoRow As New TableRow()
: Dim LogoSelectRow As New TableRow()
: While BuildLogoReader.Read
: Dim LogoID As Integer =
: BuildLogoReader.GetInt32(0)
: Dim LogoImage As String =
: BuildLogoReader.GetString(8) & BuildLogoReader.GetString: (4) & "." & BuildLogoReader.GetString(7)
: Dim LogoLocation As String =
: ConfigurationSettings.AppSettings("ProjectVirtualR oot")
: & "/domains/" & Session.Contents("PSN") & Trim(Replace
: (LogoImage, "\", "/"))
: Dim LogoCell As New TableCell()
: Dim LogoSelectCell As New TableCell()
: Dim SelectButton As New LinkButton()
: SelectButton.Text =
: GetLanguageArray.GetText(ThisPage, Language,
: LanguageArray, "Select")
: SelectButton.CommandArgument = LogoID
: AddHandler SelectButton.Command,
: AddressOf ProcessLogo
: AddHandler SelectButton.Click, AddressOf: ProcessLogo_Click
: LogoCell.Text = "<img src=""" &
: LogoLocation & """>"
: LogoSelectCell.Controls.Add (SelectButton): LogoRow.Cells.Add(LogoCell)
: LogoSelectRow.Cells.Add(LogoSelectCell)
: End While
: TableLogo.Rows.Add(LogoRow)
: TableLogo.Rows.Add(LogoSelectRow)
: BuildLogoReader.Close()
: BuildLogoConnection.Close()
: Catch x As Exception
: ErrorLogger.ErrorManager
: ("BuildCompanyLogoTableError", x)
: End Try
: End Function
.

Jul 19 '05 #3
Sorry - what I meant was - are you actually pressing the button?

Also, I suggest you post the follow up to one of the ASP.Net newsgroups,
since there are more ASP.Net people there...

Cheers
Ken
"Harold" <st*****@hotmail.com> wrote in message
news:15****************************@phx.gbl...
: Hi there, and thanks for the interest,
:
: Firstly by adding a "dymanic" eventhander as needed
: (depending on the amount of items returned)
:
: "AddHandler SelectButton.Command, AddressOf ProcessLogo"
: (see in code)
:
:
: Here it should link the button action to the
: subroutine "ProcessLogo". So if the button has a command
: (event) it should be handled by the subroutine.
:
: But it isn't. It's pretty to check, just put the routine
: in debug mode and put a break on the first best code line
: in the subroutine, then you will see the routine is never
: called. It is as if the handler is ignored.
:
: Any Ideas ?
:
: Thanks in advance.
: Harold.
: >-----Original Message-----
: >How are you "calling them", and how do you know they are
: now being called?
: >
: >Cheers
: >Ken
: >
: >
: >"Harold" <st*****@hotmail.com> wrote in message
: >news:12****************************@phx.gbl...
: >: This is just me testing, however the two top sub's are
: >: never called........why ?.
: >:
: >: Where is the error of my ways?
: >:
: >: Sub ProcessLogo(ByVal sender As Object, ByVal e As
: >: CommandEventArgs)
: >: Dim Test As Object = e.CommandArgument
: >: End Sub
: >:
: >: Sub ProcessLogo_Click(ByVal sender As Object, ByVal e
: As
: >: System.EventArgs)
: >: Dim Test As Object = CType(sender,
: >: Button).CommandName
: >: End Sub
: >:
: >: Function BuildLogoTable()
: >: '// Get logo definitions and put them in the
: table
: >: Dim ThisPage As String = "AddCompany"
: >: Dim Language As String = Session.Contents
: ("LLC")
: >: Try
: >: Dim PreviewFilePointer As String = ""
: >: Dim BuildLogoCommand As SqlCommand
: >: Dim BuildLogoReader As SqlDataReader
: >: Dim BuildLogoConnection As SqlConnection =
: >: New SqlConnection(ConfigurationSettings.AppSettings
: >: ("Publimation_Authorisation"))
: >: BuildLogoCommand = New SqlCommand
: >: ("GetImageDataByCatagory", BuildLogoConnection)
: >: BuildLogoCommand.CommandType =
: >: CommandType.StoredProcedure
: >: BuildLogoCommand.Parameters.Add
: ("@projectid",
: >: SqlDbType.Int, 4).Value = Session.Contents("PID")
: >: BuildLogoCommand.Parameters.Add
: >: ("@imagecatagory", SqlDbType.Int, 4).Value = 1
: >: BuildLogoConnection.Open()
: >: BuildLogoReader =
: >: BuildLogoCommand.ExecuteReader
: >: Dim LogoRow As New TableRow()
: >: Dim LogoSelectRow As New TableRow()
: >: While BuildLogoReader.Read
: >: Dim LogoID As Integer =
: >: BuildLogoReader.GetInt32(0)
: >: Dim LogoImage As String =
: >: BuildLogoReader.GetString(8) &
: BuildLogoReader.GetString
: >: (4) & "." & BuildLogoReader.GetString(7)
: >: Dim LogoLocation As String =
: >: ConfigurationSettings.AppSettings("ProjectVirtualR oot")
: >: & "/domains/" & Session.Contents("PSN") & Trim(Replace
: >: (LogoImage, "\", "/"))
: >: Dim LogoCell As New TableCell()
: >: Dim LogoSelectCell As New TableCell()
: >: Dim SelectButton As New LinkButton()
: >: SelectButton.Text =
: >: GetLanguageArray.GetText(ThisPage, Language,
: >: LanguageArray, "Select")
: >: SelectButton.CommandArgument = LogoID
: >: AddHandler SelectButton.Command,
: >: AddressOf ProcessLogo
: >: AddHandler SelectButton.Click,
: AddressOf
: >: ProcessLogo_Click
: >: LogoCell.Text = "<img src=""" &
: >: LogoLocation & """>"
: >: LogoSelectCell.Controls.Add
: (SelectButton)
: >: LogoRow.Cells.Add(LogoCell)
: >: LogoSelectRow.Cells.Add(LogoSelectCell)
: >: End While
: >: TableLogo.Rows.Add(LogoRow)
: >: TableLogo.Rows.Add(LogoSelectRow)
: >: BuildLogoReader.Close()
: >: BuildLogoConnection.Close()
: >: Catch x As Exception
: >: ErrorLogger.ErrorManager
: >: ("BuildCompanyLogoTableError", x)
: >: End Try
: >: End Function
: >
: >
: >.
: >
Jul 19 '05 #4
of course I (click with the mouse) Press the button, and
page is indeed posted back to the server, but as
mentioned, no further activity.

PS: thanks for the tip.

Harold
-----Original Message-----
Sorry - what I meant was - are you actually pressing the button?
Also, I suggest you post the follow up to one of the ASP.Net newsgroups,since there are more ASP.Net people there...

Cheers
Ken
"Harold" <st*****@hotmail.com> wrote in message
news:15****************************@phx.gbl...
: Hi there, and thanks for the interest,
:
: Firstly by adding a "dymanic" eventhander as needed
: (depending on the amount of items returned)
:
: "AddHandler SelectButton.Command, AddressOf ProcessLogo": (see in code)
:
:
: Here it should link the button action to the
: subroutine "ProcessLogo". So if the button has a command: (event) it should be handled by the subroutine.
:
: But it isn't. It's pretty to check, just put the routine: in debug mode and put a break on the first best code line: in the subroutine, then you will see the routine is never: called. It is as if the handler is ignored.
:
: Any Ideas ?
:
: Thanks in advance.
: Harold.
: >-----Original Message-----
: >How are you "calling them", and how do you know they are: now being called?
: >
: >Cheers
: >Ken
: >
: >
: >"Harold" <st*****@hotmail.com> wrote in message
: >news:12****************************@phx.gbl...
: >: This is just me testing, however the two top sub's are: >: never called........why ?.
: >:
: >: Where is the error of my ways?
: >:
: >: Sub ProcessLogo(ByVal sender As Object, ByVal e As
: >: CommandEventArgs)
: >: Dim Test As Object = e.CommandArgument
: >: End Sub
: >:
: >: Sub ProcessLogo_Click(ByVal sender As Object, ByVal e: As
: >: System.EventArgs)
: >: Dim Test As Object = CType(sender,
: >: Button).CommandName
: >: End Sub
: >:
: >: Function BuildLogoTable()
: >: '// Get logo definitions and put them in the
: table
: >: Dim ThisPage As String = "AddCompany"
: >: Dim Language As String = Session.Contents
: ("LLC")
: >: Try
: >: Dim PreviewFilePointer As String = ""
: >: Dim BuildLogoCommand As SqlCommand
: >: Dim BuildLogoReader As SqlDataReader
: >: Dim BuildLogoConnection As SqlConnection =: >: New SqlConnection(ConfigurationSettings.AppSettings
: >: ("Publimation_Authorisation"))
: >: BuildLogoCommand = New SqlCommand
: >: ("GetImageDataByCatagory", BuildLogoConnection)
: >: BuildLogoCommand.CommandType =
: >: CommandType.StoredProcedure
: >: BuildLogoCommand.Parameters.Add
: ("@projectid",
: >: SqlDbType.Int, 4).Value = Session.Contents("PID")
: >: BuildLogoCommand.Parameters.Add
: >: ("@imagecatagory", SqlDbType.Int, 4).Value = 1
: >: BuildLogoConnection.Open()
: >: BuildLogoReader =
: >: BuildLogoCommand.ExecuteReader
: >: Dim LogoRow As New TableRow()
: >: Dim LogoSelectRow As New TableRow()
: >: While BuildLogoReader.Read
: >: Dim LogoID As Integer =
: >: BuildLogoReader.GetInt32(0)
: >: Dim LogoImage As String =
: >: BuildLogoReader.GetString(8) &
: BuildLogoReader.GetString
: >: (4) & "." & BuildLogoReader.GetString(7)
: >: Dim LogoLocation As String =
: >: ConfigurationSettings.AppSettings ("ProjectVirtualRoot"): >: & "/domains/" & Session.Contents("PSN") & Trim (Replace: >: (LogoImage, "\", "/"))
: >: Dim LogoCell As New TableCell()
: >: Dim LogoSelectCell As New TableCell (): >: Dim SelectButton As New LinkButton()
: >: SelectButton.Text =
: >: GetLanguageArray.GetText(ThisPage, Language,
: >: LanguageArray, "Select")
: >: SelectButton.CommandArgument = LogoID: >: AddHandler SelectButton.Command,
: >: AddressOf ProcessLogo
: >: AddHandler SelectButton.Click,
: AddressOf
: >: ProcessLogo_Click
: >: LogoCell.Text = "<img src=""" &
: >: LogoLocation & """>"
: >: LogoSelectCell.Controls.Add
: (SelectButton)
: >: LogoRow.Cells.Add(LogoCell)
: >: LogoSelectRow.Cells.Add (LogoSelectCell): >: End While
: >: TableLogo.Rows.Add(LogoRow)
: >: TableLogo.Rows.Add(LogoSelectRow)
: >: BuildLogoReader.Close()
: >: BuildLogoConnection.Close()
: >: Catch x As Exception
: >: ErrorLogger.ErrorManager
: >: ("BuildCompanyLogoTableError", x)
: >: End Try
: >: End Function
: >
: >
: >.
: >
.

Jul 19 '05 #5
Hi Harold,

Did you call the BuildLogoTable() in form_load? If not, there will be such
a problem.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 19 '05 #6
Hi Harold,

Did you also declare the LinkButton as pubic variant out of the method?
Following are the code I used to test, and they seems to work well:

Dim lb As New LinkButton
Dim bb As New Button

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
lb.Text = "dddd"

Table1.Rows(0).Cells(1).Controls.Add(lb)
AddHandler lb.Click, AddressOf ProcessLogo_Click

End Sub
Public Sub ProcessLogo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)

Response.Write("dddddd")
End Sub
Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 19 '05 #7

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

Similar topics

7
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
3
by: Douglas Buchanan | last post by:
Buttons don't work if form is opened on startup A2k If 'frmMain' is set to open by default at startup none of the buttons work. If 'frmMain' is opened from the database window then all the...
15
by: Brett | last post by:
I'd like to know what management and the work environment are like where you work. I need something relative to compare my current work environment. Here's a few questions I have: 1.) Is it...
2
by: Holysmoke | last post by:
Hi, I have a asp.net form with a button in it. In the onlclick event of button I want to write a function which does some a bit of work with a timespan of 15 seconds. So I want to show a image...
1
by: Jeff | last post by:
Hello, I have developed a library of controls but for the life of me cannot get ToolboxBitmapAttribute to work -- my image simply will not display in the toolbox of any project using my...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
48
by: Jimmy | last post by:
thanks to everyone that helped, unfortunately the code samples people gave me don't work. here is what i have so far: <% Dim oConn, oRS, randNum Randomize() randNum = (CInt(1000 * Rnd) + 1) *...
33
by: bonk | last post by:
I have an application that needs to perform some background work, i.e. Logging, wich must not block the main thread. How would I basically design such a scenario? It is obvious that I should do...
11
Niheel
by: Niheel | last post by:
http://bytes.com/images/howtos/information_overloaded.jpgPaul Graham wrote an interesting article a few months back about how the internet is leading to information overload for information workers...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.