cancel
Showing results for 
Search instead for 
Did you mean: 

How to set Picture in Picture Box

Former Member
0 Kudos

Dear expert,

I design a form from screen painter and i want to show image in picture box. but when i click in picturebox show dailog box and show images but images not display in picturebox. Kindly provide me  solution what can i do.

Thanks & Regards,

Sandeep Kr

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

The picture-box must be bound to some data source - DBDataSource or UserDataSource.

Beni.

Former Member
0 Kudos

hi,

kindly help me how to set . I have use DBDatasource but its not working. Kindly provide me some code for this .

Thanks in advances,

Sandeep Kr.

pedro_magueija
Active Contributor
0 Kudos

Hi Sandeep,

In this thread there is a working example of how to do it for matrix. You can adapt it to your needs.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

Former Member
0 Kudos

Hi Pedro,

thanks for  reply

In matrix  i set image in column but i design picture box through screen painter in header label . In picture box image not set.

please help me.......

Thaks & Regards,

Sandeep kr.

pedro_magueija
Active Contributor
0 Kudos

Hi Sandeep,

Can you show us the code your are using to set the image on the picture box?


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

Former Member
0 Kudos

Hi Pedro,

here is my code....

public void OpenFileDialog()

{

            try

            {

                OpenFileDialog MyTest = new OpenFileDialog();                             

                System.Threading.Thread ShowFolderBrowserThread;

                ShowFolderBrowserThread = new System.Threading.Thread(ShowFolderBrowser);

                if (ShowFolderBrowserThread.ThreadState == System.Threading.ThreadState.Unstarted)

                {

                    ShowFolderBrowserThread.SetApartmentState(ApartmentState.STA);

                    ShowFolderBrowserThread.Start();

                   

                   

                }

                else if (ShowFolderBrowserThread.ThreadState == System.Threading.ThreadState.Stopped)

                {

                    ShowFolderBrowserThread.Start();

                    ShowFolderBrowserThread.Join();

                }

            }

            catch (Exception ex)

            { }

        }

#region : Show Image

        public void ShowFolderBrowser()

        {

            try

            {

          

                NativeWindow nws = new NativeWindow();

                OpenFileDialog MyTest = new OpenFileDialog();

                if (MyTest.ShowDialog() == DialogResult.OK)

                {

                    oPictureBox =(SAPbouiCOM.PictureBox)oForm.Items.Item("Txt_BIMG").Specific;

                  

                }

            }

            catch (Exception ex)

            { }

        }

        #endregion

Thanks & Regards,

Sandeep kr.

Former Member
0 Kudos

Hi,

You are missing the final command:

oPictureBox.Picture = MyTest.Filename;

Beni.

Former Member
0 Kudos

Hi Beni,

Thanks for your reply...

Solved............

Thanks & regards,

Sandeep kr.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sandeep,

1. check for the correct path. Its is better to give file path of project folder.

2. Sometimes image type may cause problem. so check for the image type which you are giving to picture box. .BMP and .JPG are some of the compatible format.

Best Regards.

Shekhar

Former Member
0 Kudos

Thanks for reply.

I have already check path and image .

and i also create UDF in purchase order at row label where image display when click in image row but in picture box (add-on from) image does't show.

kindly help me.

Thanks

pedro_magueija
Active Contributor
0 Kudos

Hi Sandeep,

Usually this is related to the path being incorrect. Please check that the path to the picture is correct.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn