473,385 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

TableLayout panel and picturebox in window form application

Hello tell me how to add picture box in runtime using c# me attach pic and me doing pic path add in database and still error you can see picture and plz tell me its urgent

Attached Images
File Type: jpg 1.jpg (32.8 KB, 543 views)
Dec 4 '17 #1
2 2399
Frinavale
9,735 Expert Mod 8TB
That error states that there is no imagepath column in your table.

Double check that you Have a column that holds your image path.

Double check your column name that holds the image path.
Dec 5 '17 #2
Frinavale
9,735 Expert Mod 8TB
Sharoo,

I don't have a lot of experience with picture boxes but try this and see if it fixes your problem.

Put your picture, called "testImage.png" into a folder with a known location...like C:\TestPicture\.

So the path to the image will be C:\TestPicture\testImage.png.

Now, change the line of code that you are having problems with to a string containing this path:

Expand|Select|Wrap|Line Numbers
  1. String imagePath = @"C:\TestPicture\testImage.png";
  2. picture.ImageLocation = imagePath;

I tested this code (because I'm not very familiar with the PictureBox control) and it works fine:
Expand|Select|Wrap|Line Numbers
  1. public Form1()
  2. {
  3.   InitializeComponent();
  4. }
  5.  
  6. private void Form1_Load(object sender, EventArgs e)
  7. {
  8.   PictureBox picture = new PictureBox
  9.   {
  10.     Name = "pictureBox",
  11.     Size = new Size(316, 316),
  12.     Location = new Point(5, 5),
  13.     BorderStyle = BorderStyle.FixedSingle,
  14.     SizeMode = PictureBoxSizeMode.Zoom
  15.   };
  16.   picture.ImageLocation = @"C:\testPicture\testImage.png";
  17.   this.Controls.Add(picture);
  18.   this.Size = new Size(416, 416);
  19. }
This picture box works fine with a string that contains the path provided to it's ImageLocation property.

Your problem is that your DataTable does not contain a column named "Imagepath".

You need to make sure your DataTable contains this column and that this column actually contains data.
Dec 6 '17 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Programatix | last post by:
Hi, I'm working on a project which includes XML WebServices and Windows Form application. The Windows Form application will call the XML WebServices to retrieve data from database. The data...
1
by: Kueishiong Tu | last post by:
I have a .net window form application but I have to get data from various web sites. How do I make Http request (preferrably via post method) from a window form to get the data from those web...
2
by: Kueishiong Tu | last post by:
I have a window form application. My program generates a report. I want to invoke the window notepad program to show the report. How do I do that?
2
by: MicroMoth | last post by:
Hi, Is it possible to access classes created in th app_code folder of a website, within a windows form application. The website I am trying to work with has the functionality to create a report...
1
by: Kueishiong Tu | last post by:
I have a window form application. When I port the application to another computer which has a different default font, the form gets screw up. How do I specify the font a window form use in the...
1
by: yu83thang | last post by:
Hi, May I know how to declare a Class in C++ window application form? Below is my code and error as shown below as well. here is my class declaration: ref class CLoadObj { public:
1
by: bushra lokeman | last post by:
i want to display hello in textbox when i click on a button in window form application.
1
by: Sharoo123 | last post by:
I want that no matter how many records are there in database like for examlple 10 records in database so that i should click on a button rows and columns sholuld be add after click on button i should...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.