5 Replies - 225 Views - Last Post: 01 April 2019 - 11:13 PM Rate Topic: -----

#1 Archdeacon   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-February 11

I am trying to add a bitmap image to the margin of a UserControl

Posted 30 March 2019 - 12:48 AM

Public Class UserControl1
    Private Sub UserControl1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
        Dim thisImage As Bitmap = My.Resources.Warning
       
    End Sub
:code:

I have tried everything I can to fix this, but without success. Can anyone suggest what lines need to go here please? All I want is it to appear as icons usually do. There are 3 labels on the dropdown and the icon must appear next to label2.

This post has been edited by modi123_1: 30 March 2019 - 08:04 AM
Reason for edit:: In the future please use the [code] tag button in the editor


Is This A Good Question/Topic? 0
  • +

Replies To: I am trying to add a bitmap image to the margin of a UserControl

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15160
  • View blog
  • Posts: 60,694
  • Joined: 12-June 08

Re: I am trying to add a bitmap image to the margin of a UserControl

Posted 30 March 2019 - 08:05 AM

You would need to assign the image to a control on your form. Right now you just have it assigned to a bitmap object.

Any particular reason you are not assigning it in the designer versus runtime?
Was This Post Helpful? 0
  • +
  • -

#3 Archdeacon   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-February 11

Re: I am trying to add a bitmap image to the margin of a UserControl

Posted 30 March 2019 - 05:02 PM

View Postmodi123_1, on 30 March 2019 - 08:05 AM, said:

You would need to assign the image to a control on your form. Right now you just have it assigned to a bitmap object.

Any particular reason you are not assigning it in the designer versus runtime?

Yes; the UserControl designer shows a form with 3 labels and 3 textboxes. There is no icon margin, as in form1. If I select a label and then, in Image, select the correct one, it goes under the label. The margin is produced in the Form1 dropdown which displays the userControl.
Was This Post Helpful? 0
  • +
  • -

#4 Archdeacon   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-February 11

Re: I am trying to add a bitmap image to the margin of a UserControl

Posted 31 March 2019 - 07:48 AM

View PostArchdeacon, on 30 March 2019 - 05:02 PM, said:

View Postmodi123_1, on 30 March 2019 - 08:05 AM, said:

You would need to assign the image to a control on your form. Right now you just have it assigned to a bitmap object.

Any particular reason you are not assigning it in the designer versus runtime?

Yes; the UserControl designer shows a form with 3 labels and 3 textboxes. There is no icon margin, as in form1. If I select a label and then, in Image, select the correct one, it goes under the label. The margin is produced in the Form1 dropdown which displays the userControl.

Below is the code, some of which fails:
 Dim card As Image = My.Resources.credit_card
       Dim warn As Image = My.Resources.Warning
        AccountToolStripMenuItem.DropDownItems.Clear()
        AccountToolStripMenuItem.DropDownItems.Add(" Default User Settings", card)  'This works
        AccountToolStripMenuItem.DropDownItems.Add("-")                             'This works
        AccountToolStripMenuItem.DropDownItems.Add(label1,textbox1,label2, warn) 'Error: cannot convert textbox1 to string


What I need is the correct way to add a line of 4 items, as everything else seems to work. Can somebody help please?
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15160
  • View blog
  • Posts: 60,694
  • Joined: 12-June 08

Re: I am trying to add a bitmap image to the margin of a UserControl

Posted 31 March 2019 - 08:34 AM

I don't understand your response. In post #1 - nothing there shows you assigning the image to an actual web control.

In post 4 - post the error message.
Was This Post Helpful? 0
  • +
  • -

#6 Archdeacon   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-February 11

Re: I am trying to add a bitmap image to the margin of a UserControl

Posted 01 April 2019 - 11:13 PM

https://stackoverflo...e-toolstripdrop

This link deacribes almost exactly what I am trying to do, ie add an image, a label, textbox, a second label, all in the same row; but I need the .NET version as I do not know any C#.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1