Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

Reference to a non-shared member requires an object reference

$
0
0
What I'm trying to do is reference a sub that is located on a user control. This part would be located on the user control:

Code:

Public Sub CacheClear()

(code)

End Sub


And on the other form that I'm trying to access and fire the code on, I'd use:

Code:

Private Sub ClearCache_Click(sender As System.Object, e As System.EventArgs) Handles ClearCache.Click
QtpBrowser.CacheClear()
End Sub


Now, I already set the modifiers on the user control, and all the elements within the user control to Public, but I still can't access the code in the user control from the form. I stupidy tried referencing it by just basically: (usercontrolname).ClearCache() which didn't work. If I just leave it the way it is, it says that it's not declared (i'm assuming because the access level is preventing it somehow even though it's already Public. I also tried making the code in the user control Public Shared. Any ideas? Thanks!

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>