0

In Visual basic I want to be able to hide a tab based on whether the currently logged on users is in a certain group in Active directory.

I have already managed to link to active directory and pull back full name and phone number etc.

Not sure if this would be possible

  • This could help you [VB.Net Hide Tabpage](http://stackoverflow.com/questions/9055672/vb-net-hide-tabpage) – the_lotus Dec 16 '14 at 14:52

2 Answers2

0

Your question isn't too clear, but if I understand it correctly, it's pretty simple:

If IsInActiveGroup(Environment.UserName) 'or whatever username data you'd like...
    TabControl1.TabPages.Remove(tabYourTabName)
Else
    TabControl1.TabPages.Add(tabYourTabName)
End If

IsInActiveGroup being some function you create to iterate through your list of users and see if he's in there. I'm not sure what data type you're storing the "active directory users" in.

Keith
  • 1,331
  • 2
  • 13
  • 18
  • Thanks I managed to do it this way in the end. `If My.User.IsInRole("AD GROUP") Then despatchonly.Show() Else despatchonly.Hide() End If` – Danny Broadhurst Dec 18 '14 at 08:44
0

This is how I managed to do it

If My.User.IsInRole("AD GROUP") Then despatchonly.Show() Else despatchonly.Hide() End If