0

How can i pass the value of two variables into a click event in my ASP.net forms application.

i have 2 varaibles:

DocNo & Prefix which i need the values of in the click event, i am new to this i know i obviously cannot use ByVal which is used further down the document,

here is my code block in which i need to pass the varaibles into,

If Settings.IsCountryMode("USA") Then
                Script = "ShowPrintJobQuestionModal('" & Prefix & "', '" & DocNo & "', " & PrintDLG & ", " & Reprint & ", '" & ScrollBars & "');"
                'Redriects to a page in a new separate window
                'CreateOutput(AutoworkDocument.dt.job, Assign, AWDLineNo)
            Else
                General.RunJava(Me, General.OutputDoc("^", "", , , , , , False), "MultiDoc")
            End If

            RunJava(Script)
4
  • @K.K.Agarwal i am trying to find out how to pass the values of DocNo and Prefix into that Sub, the rest of the Subs uses ByVal to get the values, i cannot do this on this click event Commented Jun 19, 2014 at 11:16
  • Any error you are getting in your code? Commented Jun 19, 2014 at 11:23
  • No error the variables just are not receiving the correct values as they are just delcared as empty strings, i do not know how to pass the values i need, Commented Jun 19, 2014 at 11:27
  • first assign the value in the variable then check it... Commented Jun 19, 2014 at 11:29

2 Answers 2

1

Unless I'm misunderstanding your question...

Set the variable as public in your other class/form and use it:

COtherClassName.DocNo 
Sign up to request clarification or add additional context in comments.

5 Comments

Tried this and it didn't work Dim Prefix As String Prefix = AutoworkDocument.GetDocumentPrefix(Prefix)
getdocumentprefix is the name of the function that returns the prefix i need
Dim isn't public. Create the variable as a member variable of the class: Public Prefix As String, then you can use it outside of the class: COtherClassName.Prefix
Thanks, i have now hard coded prefix which is ok however docnum i need, i have tried this code and i am now getting object reference not set to instance of an object Dim awd As AutoworkDocument Dim DocNo As String = String.Empty DocNo = awd.DocNum
awd.DocNum won't work unless DocNum is public in the AutoworkDocument class.
1

Now resolved,

Dim awd As AutoworkDocument
  awd = New AutoworkDocument()
  awd.loadSes()

  jobNo = awd.DocNum

If Settings.IsCountryMode("USA") Then
  Script = "ShowPrintJobQuestionModal('" & Prefix & "', '" & jobNo & "', " & PrintDLG & ", " & Reprint & ", '" & ScrollBars & "');"

 Else
 General.RunJava(Me, General.OutputDoc("^", "", , , , , , False), "MultiDoc")
 End If

RunJava(Script)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.