Home » VB.NetRSS

Font Property Weight in VB.Net

I have below code in VB 6.0.After migration I got one issue with weight property.Please give some suggestions....

Before migration:

LabelFont.Name = mobjScaleBar.IntervalLabelFont.Name
    LabelFont.Bold = mobjScaleBar.IntervalLabelFont.Bold
    LabelFont.Italic = mobjScaleBar.IntervalLabelFont.Italic
    LabelFont.Size = mobjScaleBar.IntervalLabelFont.Size
    LabelFont.Charset = mobjScaleBar.IntervalLabelFont.Charset
    LabelFont.Strikethrough = mobjScaleBar.IntervalLabelFont.Strikethrough
    LabelFont.Underline = mobjScaleBar.IntervalLabelFont.Underline
    LabelFont.Weight = mobjScaleBar.IntervalLabelFont.Weight
    Set GMScaleBar1.IntervalLabelFont = LabelFont

After Migration:

'Interval label font

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeName(LabelFont, mobjScaleBar.IntervalLabelFont.Name)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeBold(LabelFont, mobjScaleBar.IntervalLabelFont.Bold)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeItalic(LabelFont, mobjScaleBar.IntervalLabelFont.Italic)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeSize(LabelFont, mobjScaleBar.IntervalLabelFont.Size)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeGdiCharSet(LabelFont, mobjScaleBar.IntervalLabelFont.Charset)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeStrikeOut(LabelFont, mobjScaleBar.IntervalLabelFont.Strikethrough)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeUnderline(LabelFont, mobjScaleBar.IntervalLabelFont.Underline)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

'UPGRADE_ISSUE: Font property LabelFont.Weight was not upgraded. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'

LabelFont.Weight = mobjScaleBar.IntervalLabelFont.Weight

GMScaleBar1.IntervalLabelFont = LabelFont

 

6 Answers Found

 

Answer 1

Maddurajesh,

Based on your post, there is no LabelFont property  in Visual Studio .NET. If you are using the Label control in unmanaged VB 6, I would like to suggest you to use standard Label control instead of the old one in VB.NET form application, then change the font  property of the .NET standard Label control. This is the best choice and easy to change in .NET development.

The following code  snippet shows the upgrade code in Visual Studio 2008 Upgrade VB 6 code wizard of my local machine(different from yours):

Code Snippet

'UPGRADE_WARNING: Couldn't resolve  default property of object  LabelFont.Name. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

'UPGRADE_WARNING: Couldn't resolve default  property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont.Name = mobjScaleBar.IntervalLabelFont.Name

'UPGRADE_WARNING: Couldn't resolve default property of object LabelFont.Bold. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont.Bold = mobjScaleBar.IntervalLabelFont.Bold

'UPGRADE_WARNING: Couldn't resolve default property of object LabelFont.Italic. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont.Italic = mobjScaleBar.IntervalLabelFont.Italic

'UPGRADE_WARNING: Couldn't resolve default property of object LabelFont.Size. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont.Size = mobjScaleBar.IntervalLabelFont.Size

'UPGRADE_WARNING: Couldn't resolve default property of object LabelFont.Charset. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont.Charset = mobjScaleBar.IntervalLabelFont.Charset

'UPGRADE_WARNING: Couldn't resolve default property of object LabelFont.Strikethrough. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont.Strikethrough = mobjScaleBar.IntervalLabelFont.Strikethrough

'UPGRADE_WARNING: Couldn't resolve default property of object LabelFont.Underline. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont.Underline = mobjScaleBar.IntervalLabelFont.Underline

'UPGRADE_WARNING: Couldn't resolve default property of object LabelFont.Weight. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont.Weight = mobjScaleBar.IntervalLabelFont.Weight

'UPGRADE_WARNING: Couldn't resolve default property of object GMScaleBar1.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

GMScaleBar1.IntervalLabelFont = LabelFont

 

Answer 2

Thanks for replay..

Here Iam converting my code  from VB 6.0 to VS 2005..So, please give  some suggestions  on the same...

 

Answer 3

Here Iam migrating my Vb 6.0 code  to VS 2005, below issues are displayed. Please give  suggestions for resolving the same.

Before migration:

LabelFont.Name = mobjScaleBar.IntervalLabelFont.Name
    LabelFont.Bold = mobjScaleBar.IntervalLabelFont.Bold
    LabelFont.Italic = mobjScaleBar.IntervalLabelFont.Italic
    LabelFont.Size = mobjScaleBar.IntervalLabelFont.Size
    LabelFont.Charset = mobjScaleBar.IntervalLabelFont.Charset
    LabelFont.Strikethrough = mobjScaleBar.IntervalLabelFont.Strikethrough
    LabelFont.Underline = mobjScaleBar.IntervalLabelFont.Underline
    LabelFont.Weight = mobjScaleBar.IntervalLabelFont.Weight
    set  GMScaleBar1.IntervalLabelFont = LabelFont

After Migration:

'Interval label  font

'UPGRADE_WARNING: Couldn't resolve  default property  of object  mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeName(LabelFont, mobjScaleBar.IntervalLabelFont.Name)

'UPGRADE_WARNING: Couldn't resolve default  property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeBold(LabelFont, mobjScaleBar.IntervalLabelFont.Bold)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeItalic(LabelFont, mobjScaleBar.IntervalLabelFont.Italic)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeSize(LabelFont, mobjScaleBar.IntervalLabelFont.Size)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeGdiCharSet(LabelFont, mobjScaleBar.IntervalLabelFont.Charset)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeStrikeOut(LabelFont, mobjScaleBar.IntervalLabelFont.Strikethrough)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

LabelFont = VB6.FontChangeUnderline(LabelFont, mobjScaleBar.IntervalLabelFont.Underline)

'UPGRADE_WARNING: Couldn't resolve default property of object mobjScaleBar.IntervalLabelFont. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

'UPGRADE_ISSUE: font  property LabelFont.Weight was not upgraded. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="CC4C7EC0-C903-48FC-ACCC-81861D12DA4A"'

LabelFont.Weight = mobjScaleBar.IntervalLabelFont.Weight

GMScaleBar1.IntervalLabelFont = LabelFont

 

Answer 4

I'm having a similar issue, but less with the Label and more with an Object. Maddu is having a similar upgrade problem here and I believe it's less an issue  with the Label and more an issue with the Object... it just can't find the default property  for the mobjScaleBar Object. How does one get around this? I'm having a similar issue with an object  in code  someone was using in VB6 and I'm upgrading to .NET on the 2005 IDE.

Any ideas?

-Fusion

 

Answer 5

I found out what was happening in my code. The upgraded  version wasn't happy with referencing an object  (late binding), so once i made reference to the .dll and then dimensioned the variable as the proper object instead of just "Object" the IDE was happy again. Now i'm going through and changing the methods that are no longer members of the object to the newer, renamed ones.

Hopefully Maddu has found the answer to his label issue  as well!

- Fusion

 

Answer 6

Private Function sButton(ByRef sCaption As String) As Object
'************************************************************************************************
'*                                                                                              *
'************************************************************************************************
'UPGRADE_WARNING: Couldn't resolve  default property  of object  sButton. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
sButton = "&nbsp<button style='font-family:tahoma; font-size:10px'>" & sCaption & "</button>"
End Function 'sButton


I dont know how to fix it .  This is my first. Thanks a lot for all help.

Rao
 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter