Passing an array value to the textbox, returns null. Why?

  • Thread starter Thread starter VBcoder vb
  • Start date Start date
V

VBcoder vb

I have a function USTRST where it finds the value of USPoP_CityA as
shown below (the value is searched from a database)

Redim P_Lline(9)
USPoPA_City = Cells(adrsX, adrsY + 5)

P_Lline(0) = "US " & USPoPA_City (when i return this value in any excel
cell, i get the value of USPoPA_City, in the cell)

Dim city As String
city = "hello"

P_Lline(9) = "test" city & USPoPA_City (when i do this, i get "test
hello" in my text box, and not the value of USPoPA_City.


Then in a public variable i have set

CityA = USPoPA_City (suppose to be "fortworth")

ActiveSheet.OLEObjects("txtbCityA").object.Value = "City A: " & CityA

So when i run my program, i only get "test hello", and not value of the
USPoP_City. I put a breakpoint to see what is being returned, so it
shows that within the funtion the value is null, so that is what is
being passed. But how is that at the same time from the same function i
get fortworth in the excel cell.


I have been stuck on this problem for more then 2 weeks, and cant move
forward. Please help. Thanks.
 
VBcoder vb said:
I have a function USTRST where it finds the value of USPoP_CityA as
shown below (the value is searched from a database)

Redim P_Lline(9)
USPoPA_City = Cells(adrsX, adrsY + 5)


Is this is a VB.Net application? Doesn't look as if.


Armin
 
VBcoder vb said:
I have a function USTRST where it finds the value of USPoP_CityA as
shown below (the value is searched from a database)

You have a function called USTRST!?!?!? You *really* need to start coming up
with some more descriptive names. :-)
Redim P_Lline(9)
USPoPA_City = Cells(adrsX, adrsY + 5)

Ditto for your var names also :-)
ActiveSheet.OLEObjects("txtbCityA").object.Value = "City A: " & CityA

So when i run my program, i only get "test hello", and not value of the
USPoP_City. I put a breakpoint to see what is being returned, so it
shows that within the funtion the value is null, so that is what is
being passed. But how is that at the same time from the same function i
get fortworth in the excel cell.

Put a breakpoint on the line (push F9) above and mouse over each variable to
see what value they hold.

Michael
 
Back
Top