VB.Net Data Repeater Help

Hello,

I have the following situation:
-A basic VB app with a single DataRepeater
-The data repeater is connected to an Access Table Via Binding Source -> Data Set

I have three fields ID, Description, PDFExists

On the data repeater, I have two txt boxes and a button.
-Txt boxes for ID and Description
-Button "View PDF"

I want to make it so that if PDFExists equals True, the button is Visible, if False, the button is Not Visible

I already have code setups the button link (essentially sets the button Tag to the unique ID number), see attached, and that works fine.  

Any suggestions on how to handle showing the button.  I suspect that if I added a text box for PDFExists, and checked it's text, I could easily accomplish this, but I would prefer to access the data directly.
Private Sub DataRepeater1_DrawItem(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs) Handles DataRepeater1.DrawItem
        btnViewPDF.Tag = e.DataRepeaterItem.Controls(NumTextBox.Name).Text
End Sub

Open in new window

compsol1993Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
This is kind of a hack, but you can keep the CheckBox that the boolean field defaults to (or change it to CheckBox if it's not set) and set its Visible property to false, drag a regular button onto the DataRepeater, and then in your DrawItem handler, you could add the following:
Private Sub DataRepeater1_Items(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.PowerPacks.DataRepeaterItemEventArgs) Handles DataRepeater1.DrawItem
    Dim box As CheckBox = DirectCast(e.DataRepeaterItem.Controls("PDFExistsCheckBox"), CheckBox)
    Dim btn As Button = DirectCast(e.DataRepeaterItem.Controls("Button1"), Button)

    btn.Visible = box.Checked
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
compsol1993Author Commented:
Thanks for the advice.  I'll give this a try, and may have to go this route.

Do you (or anyone else) know of a way to accomplish this without needing an "Invisible" Check Box on the form?

Thanks
0
käµfm³d 👽Commented:
Do you (or anyone else) know of a way to accomplish this without needing an "Invisible" Check Box on the form?
I'm still trying to locate a way to reach the data being bound in this control. I have been unsuccessful so far, which is why I posted the hack. If I can find it, I'll post back  : )
0
compsol1993Author Commented:
Sounds good, the Chkbox concept does work, and it's small enough that since it's invisible, it won't be in the way.

thanks for the help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.