473,396 Members | 2,030 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,396 software developers and data experts.

Passing Arguments?

Hello,

I have created Sub that requires one argument which is a string. However,
when I run the Sub, the string is not passed as it should be. Here is the
code

Public Sub fCrewLookup(ByVal x As String)

CrewPos = x
Me.AddCrew.Visible = False
Me.CrewLookup.Visible = True
SqlDataAdapter3.Fill(DataSet41)
dgCrewLookup.SelectedIndex() = -1
dgCrewLookup.DataBind()

End Sub

Private Sub ibPFLookup_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles ibPFLookup.Click

fCrewLookup("PF")

End Sub

And finally what is supposed to be the result:

Private Sub CrewLookupSelect_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CrewLookupSelect.Click

If dgCrewLookup.SelectedIndex < 0 Then

MessageBox.Show("Please select a crew member.", "Selection Error",
MessageBoxButtons.OK, MessageBoxIcon.Information,
MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)

Else

Dim sUID As String

sUID = dgCrewLookup.SelectedItem.Cells(0).Text()

PFID.Text = CrewPos

Me.CrewLookup.Visible = False

Me.AddCrew.Visible = True

End If

End Sub

End Class

The variable CrewPos is declared as a variable in the Public Class block so
that it is global in scope to the entire application.What am I missing that
is not causing the argument to be passed? This works fin in VB.NET, but not
using VB in ASP.NET.

Thanks in advance,

Kris
Nov 18 '05 #1
4 1725
gowd, i hate to look at vb code...arggggghhhh

The web environment operates differently than the windows environment. Your
CrewPos = x assignment lasts exactly as long as the sub routine executes
then it is gone. You will need to persist it to storage so it can survive
the posting process. If you store it in viewstate for example, then when you
need it in the click routine, pull it out of viewstate and use it.

On each post, nothing lasts unless it is explicitly stored in a database, or
cached in storage.

It may be worth your while to read up a little on the web architecture and
the ASP.NET paradigm
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in
message news:Ov*************@tk2msftngp13.phx.gbl...
Hello,

I have created Sub that requires one argument which is a string. However,
when I run the Sub, the string is not passed as it should be. Here is the
code

Public Sub fCrewLookup(ByVal x As String)

CrewPos = x
Me.AddCrew.Visible = False
Me.CrewLookup.Visible = True
SqlDataAdapter3.Fill(DataSet41)
dgCrewLookup.SelectedIndex() = -1
dgCrewLookup.DataBind()

End Sub

Private Sub ibPFLookup_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles ibPFLookup.Click

fCrewLookup("PF")

End Sub

And finally what is supposed to be the result:

Private Sub CrewLookupSelect_Click(ByVal sender As System.Object, ByVal e
As
System.EventArgs) Handles CrewLookupSelect.Click

If dgCrewLookup.SelectedIndex < 0 Then

MessageBox.Show("Please select a crew member.", "Selection Error",
MessageBoxButtons.OK, MessageBoxIcon.Information,
MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)

Else

Dim sUID As String

sUID = dgCrewLookup.SelectedItem.Cells(0).Text()

PFID.Text = CrewPos

Me.CrewLookup.Visible = False

Me.AddCrew.Visible = True

End If

End Sub

End Class

The variable CrewPos is declared as a variable in the Public Class block
so
that it is global in scope to the entire application.What am I missing
that
is not causing the argument to be passed? This works fin in VB.NET, but
not
using VB in ASP.NET.

Thanks in advance,

Kris

Nov 18 '05 #2
gowd, i hate to look at vb code...arggggghhhh

The web environment operates differently than the windows environment. Your
CrewPos = x assignment lasts exactly as long as the sub routine executes
then it is gone. You will need to persist it to storage so it can survive
the posting process. If you store it in viewstate for example, then when you
need it in the click routine, pull it out of viewstate and use it.

On each post, nothing lasts unless it is explicitly stored in a database, or
cached in storage.

It may be worth your while to read up a little on the web architecture and
the ASP.NET paradigm
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in
message news:Ov*************@tk2msftngp13.phx.gbl...
Hello,

I have created Sub that requires one argument which is a string. However,
when I run the Sub, the string is not passed as it should be. Here is the
code

Public Sub fCrewLookup(ByVal x As String)

CrewPos = x
Me.AddCrew.Visible = False
Me.CrewLookup.Visible = True
SqlDataAdapter3.Fill(DataSet41)
dgCrewLookup.SelectedIndex() = -1
dgCrewLookup.DataBind()

End Sub

Private Sub ibPFLookup_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles ibPFLookup.Click

fCrewLookup("PF")

End Sub

And finally what is supposed to be the result:

Private Sub CrewLookupSelect_Click(ByVal sender As System.Object, ByVal e
As
System.EventArgs) Handles CrewLookupSelect.Click

If dgCrewLookup.SelectedIndex < 0 Then

MessageBox.Show("Please select a crew member.", "Selection Error",
MessageBoxButtons.OK, MessageBoxIcon.Information,
MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)

Else

Dim sUID As String

sUID = dgCrewLookup.SelectedItem.Cells(0).Text()

PFID.Text = CrewPos

Me.CrewLookup.Visible = False

Me.AddCrew.Visible = True

End If

End Sub

End Class

The variable CrewPos is declared as a variable in the Public Class block
so
that it is global in scope to the entire application.What am I missing
that
is not causing the argument to be passed? This works fin in VB.NET, but
not
using VB in ASP.NET.

Thanks in advance,

Kris

Nov 18 '05 #3
Alvin,

Thanks for your reply. It has cleared up a few things.

I am actually quite familiar with web achitecture, it just happens to be the
old ASP that I have worked with. I'd love to make the jump to using C#, but
time doesn't allow for that at this point.

Regards,
Kris
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:#t**************@TK2MSFTNGP12.phx.gbl...
gowd, i hate to look at vb code...arggggghhhh

The web environment operates differently than the windows environment. Your CrewPos = x assignment lasts exactly as long as the sub routine executes
then it is gone. You will need to persist it to storage so it can survive
the posting process. If you store it in viewstate for example, then when you need it in the click routine, pull it out of viewstate and use it.

On each post, nothing lasts unless it is explicitly stored in a database, or cached in storage.

It may be worth your while to read up a little on the web architecture and
the ASP.NET paradigm
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in message news:Ov*************@tk2msftngp13.phx.gbl...
Hello,

I have created Sub that requires one argument which is a string. However, when I run the Sub, the string is not passed as it should be. Here is the code

Public Sub fCrewLookup(ByVal x As String)

CrewPos = x
Me.AddCrew.Visible = False
Me.CrewLookup.Visible = True
SqlDataAdapter3.Fill(DataSet41)
dgCrewLookup.SelectedIndex() = -1
dgCrewLookup.DataBind()

End Sub

Private Sub ibPFLookup_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles ibPFLookup.Click

fCrewLookup("PF")

End Sub

And finally what is supposed to be the result:

Private Sub CrewLookupSelect_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CrewLookupSelect.Click

If dgCrewLookup.SelectedIndex < 0 Then

MessageBox.Show("Please select a crew member.", "Selection Error",
MessageBoxButtons.OK, MessageBoxIcon.Information,
MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)

Else

Dim sUID As String

sUID = dgCrewLookup.SelectedItem.Cells(0).Text()

PFID.Text = CrewPos

Me.CrewLookup.Visible = False

Me.AddCrew.Visible = True

End If

End Sub

End Class

The variable CrewPos is declared as a variable in the Public Class block
so
that it is global in scope to the entire application.What am I missing
that
is not causing the argument to be passed? This works fin in VB.NET, but
not
using VB in ASP.NET.

Thanks in advance,

Kris


Nov 18 '05 #4
Alvin,

Thanks for your reply. It has cleared up a few things.

I am actually quite familiar with web achitecture, it just happens to be the
old ASP that I have worked with. I'd love to make the jump to using C#, but
time doesn't allow for that at this point.

Regards,
Kris
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:#t**************@TK2MSFTNGP12.phx.gbl...
gowd, i hate to look at vb code...arggggghhhh

The web environment operates differently than the windows environment. Your CrewPos = x assignment lasts exactly as long as the sub routine executes
then it is gone. You will need to persist it to storage so it can survive
the posting process. If you store it in viewstate for example, then when you need it in the click routine, pull it out of viewstate and use it.

On each post, nothing lasts unless it is explicitly stored in a database, or cached in storage.

It may be worth your while to read up a little on the web architecture and
the ASP.NET paradigm
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in message news:Ov*************@tk2msftngp13.phx.gbl...
Hello,

I have created Sub that requires one argument which is a string. However, when I run the Sub, the string is not passed as it should be. Here is the code

Public Sub fCrewLookup(ByVal x As String)

CrewPos = x
Me.AddCrew.Visible = False
Me.CrewLookup.Visible = True
SqlDataAdapter3.Fill(DataSet41)
dgCrewLookup.SelectedIndex() = -1
dgCrewLookup.DataBind()

End Sub

Private Sub ibPFLookup_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles ibPFLookup.Click

fCrewLookup("PF")

End Sub

And finally what is supposed to be the result:

Private Sub CrewLookupSelect_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CrewLookupSelect.Click

If dgCrewLookup.SelectedIndex < 0 Then

MessageBox.Show("Please select a crew member.", "Selection Error",
MessageBoxButtons.OK, MessageBoxIcon.Information,
MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)

Else

Dim sUID As String

sUID = dgCrewLookup.SelectedItem.Cells(0).Text()

PFID.Text = CrewPos

Me.CrewLookup.Visible = False

Me.AddCrew.Visible = True

End If

End Sub

End Class

The variable CrewPos is declared as a variable in the Public Class block
so
that it is global in scope to the entire application.What am I missing
that
is not causing the argument to be passed? This works fin in VB.NET, but
not
using VB in ASP.NET.

Thanks in advance,

Kris


Nov 18 '05 #5

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

Similar topics

7
by: Pavils Jurjans | last post by:
Hallo, I have been programming for restricted environments where Internet Explorer is a standard, so I haven't stumbled upon this problem until now, when I need to write a DOM-compatible code. ...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
39
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down...
5
by: Michael | last post by:
Hi, once I read here that it is not 'a good idea' to pass variables that are not initialized to a function. I have void something ( double *vector ); ....
3
by: Mantorok | last post by:
Hi all I'm pretty new to ASP.Net, is it possible to pass arguments (maybe objects too) to web forms without using a querystring in the URL? Thanks Kev
4
by: Justine | last post by:
Can anyone help? e.g. when you open a vb project property page, in "Configuration Properties" You will see "Command line arguments" in "Start Options". Does anyone knows how to find a way to do...
7
by: Bonzo | last post by:
>From within a function, I want to pass a/some parameters to another function, AND all arguments, passed into this function. e.g. function firstFunction(){ //this function may have been...
2
by: william.w.oneill | last post by:
I have an application that takes a few command line parameters. As recommended by others in this group, I'm using a named mutex to ensure that only one instance of the application is running. My...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.