0

My userControl1.cs contains a text box and a picture box how do I add a property to my class to allow it to get a picture from a url string

this is what i have so far

    public partial class UserControl1 : UserControl
{
    public UserControl1()
    {
        InitializeComponent();
    }

    public override string Text
    {
        get
        {
            return textBox1.Text;
        }

        set
        {
            textBox1.Text = value;
        }
    }

}
user2184248
  • 27
  • 1
  • 9

1 Answers1

1

This is how you add the property,

public Image PictureFromWeb  { get; set;}

but there is a better way

The inbuilt PictureBox.Load(string URL) Method "sets the ImageLocation to the specified URL and displays the image indicated." (Since .NetFramework 2)
Quoted from This Answer -- Upvote his answer

Community
  • 1
  • 1
wruckie
  • 1,717
  • 1
  • 23
  • 34
  • so im trying to have the picture box in the user control get url and convert it into a pic, Im using userControl11.UserPicture = tweet.Creator.DownloadProfileImage(token); DownloadProfileImage retrieves the url string. I changed FamilyPicture to UserPicture – user2184248 Jan 25 '14 at 22:50