Tab Control with Images

  • Thread starter Thread starter david.pope
  • Start date Start date
D

david.pope

What's the best way to get an image on the device tab control?

Does anyone have a code example or know of a 3rd party component that
supports this?

Thanks,

Dave
 
I am usig VB and the link is to a C# fix. I am trying to convert but am
inexperienced and I am getting grief about formTabs not being declared.
WHat do I need to do?
 
Linda I think you have replied to the wrong thread. Assuming you are talking
about the tab order bug all you need to do is replace "this" with "Me" and
remove the semicolons (;)

For future issues with C# to VB translation consider one of the many online
converters, such as:
http://www.kamalpatel.net/ConvertCSharp2VB.aspx

Cheers
Daniel
 
Yeah I did reply to the wrong thread sorry. But anyway I figured out the me
and the semicolon, bu t the error I get is on :
TabPage.ControlCollection.SetChildIndex(Me.TabGetGoing, 1) and it gives the
error
a reference to a nonshared member requiers an object reference
?????
 
The original code was:
formTabs.Controls.SetChildIndex

where formTabs is a TabControl

So replace fromTabs with your variable name for your TabControl.
In the SetChildIndex pass the variable name of your TabPage.

Cheers
Daniel
 
OK, I got it. No errors. Thank you.

Only it still leaves two tabs switched around. Now I see that this article
says "Bear in mind that the tabs will still appear in the wrong order in the
designer, but they will always be in the right order when the application
runs." so does this mean that if I deploy it instead of running in debug,
that it will be fixed?

Something tells me no.
 
No, it either works on your target or it doesn't. Note how the example there
shows the order the tabs will appear in and calls SetChildIndex in the right
order accordingly. Also note how it the calls to SetChildIndex (one per tab)
are made in the form constructor after the call to initializecomponent.

If you are still having trouble, show me the lines of code with the
SetChildIndex. Tell me which order you expect them to appear in.

Cheers
Daniel
 
#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

'fix from msdn for tab order problem
'the tab control is tbAddName

tbAddName.Controls.SetChildIndex(Me.TabGetGoing, 1)
tbAddName.Controls.SetChildIndex(Me.startTab, 1)
tbAddName.Controls.SetChildIndex(Me.SearchTab, 1)
tbAddName.Controls.SetChildIndex(Me.ViewTab, 1)
tbAddName.Controls.SetChildIndex(Me.EditTab, 1)
tbAddName.Controls.SetChildIndex(Me.insertTab, 1)

End Sub

*************************************************
The order that the tabs are supposed to appear in are the same order that
you see them in here with insert on the far right and getgoing on the left.
 
BTW it is view and search that are switched and they stay that way regardless
of whatever changes I make to the order.
 
Can you make sure you are running the latest service pack on the target? How
to check and where to get is here:
http://wiki.opennetcf.org/ow.asp?CompactFrameworkFAQ/DeterminingVersion

If all else fails, this always works (instead of the SetChildIndex
approach):
tbAddName.TabPages.Clear()
tbAddName.TabPages.Add(Me.TabGetGoing)
tbAddName.TabPages.Add(Me.startTab)
tbAddName.TabPages.Add(Me.SearchTab)
tbAddName.TabPages.Add(Me.ViewTab)
tbAddName.TabPages.Add(Me.EditTab)
tbAddName.TabPages.Add(Me.insertTab)
Me.TabGetGoing.Text = "1. TabGetGoing"
Me.startTab.Text = "2. startTab"
Me.SearchTab.Text = "3. SearchTab"
Me.ViewTab.Text = "4. ViewTab"
Me.EditTab.Text = "5. EditTab"
Me.insertTab.Text = "6. insertTab"

Cheers
Daniel
 
Daniel Moth said:
Can you make sure you are running the latest service pack on the target? How
to check and where to get is here:
http://wiki.opennetcf.org/ow.asp?CompactFrameworkFAQ/DeterminingVersion

If all else fails, this always works (instead of the SetChildIndex
approach):
tbAddName.TabPages.Clear()
tbAddName.TabPages.Add(Me.TabGetGoing)
tbAddName.TabPages.Add(Me.startTab)
tbAddName.TabPages.Add(Me.SearchTab)
tbAddName.TabPages.Add(Me.ViewTab)
tbAddName.TabPages.Add(Me.EditTab)
tbAddName.TabPages.Add(Me.insertTab)
Me.TabGetGoing.Text = "1. TabGetGoing"
Me.startTab.Text = "2. startTab"
Me.SearchTab.Text = "3. SearchTab"
Me.ViewTab.Text = "4. ViewTab"
Me.EditTab.Text = "5. EditTab"
Me.insertTab.Text = "6. insertTab"

Cheers
Daniel
--
http://www.danielmoth.com/Blog/




I already had it but loaded it again. Same results. Can't figure why it is
so determined to switch those two tabs only. I can give up, it is not
mission critical, but I would like to know "What the heck????"
 
Can you post the project (or a repro)? Also what device or emulator are you
trying this on?

Cheers
Daniel
 
Hi Linda

I tried your project and indeed the SetChildIndex has no effect on your PPC
project.

However the alternative approach I described works very well (even on a
PPC2002 emulator with no service pack). Can you please make sure you try
that on your end as well?

I repeat the code here for your convenience. Replace your Form's New with
this one:
Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
'fix from msdn for tab order problem
''tbAddName.Controls.SetChildIndex(Me.insertTab, 1)
''tbAddName.Controls.SetChildIndex(Me.EditTab, 1)
''tbAddName.Controls.SetChildIndex(Me.ViewTab, 1)
''tbAddName.Controls.SetChildIndex(Me.SearchTab, 1)
''tbAddName.Controls.SetChildIndex(Me.startTab, 1)
''tbAddName.Controls.SetChildIndex(Me.TabGetGoing, 1)

tbAddName.TabPages.Clear()

' Order from left to right
tbAddName.TabPages.Add(Me.TabGetGoing)
tbAddName.TabPages.Add(Me.startTab)
tbAddName.TabPages.Add(Me.SearchTab)
tbAddName.TabPages.Add(Me.ViewTab)
tbAddName.TabPages.Add(Me.EditTab)
tbAddName.TabPages.Add(Me.insertTab)

' Replace text with your own
Me.TabGetGoing.Text = "1. TabGetGoing"
Me.startTab.Text = "2. startTab"
Me.SearchTab.Text = "3. SearchTab"
Me.ViewTab.Text = "4. ViewTab"
Me.EditTab.Text = "5. EditTab"
Me.insertTab.Text = "6. insertTab"
End Sub


Cheers
Daniel
 
Strangely enough I dinked around with other stuff and it just started
working. I have heard this refrain more than a few times from developers on
these little guys.
 
Back
Top