How to show picturebox image in c# according to the individual digit of roll no?


I have a roll no of 6 digits. Below every digit there are 10 images(picturebox). WHen any digit matches with the last value of picturebox like 0 I want to show that image and hides other. Here is my code:

private void btnFill_Click(object sender, EventArgs e)

        string[] splitted = System.Text.RegularExpressions.Regex.Split(rollNo, @"\s{2,}");
        int[] nums = new int[splitted.Length];
        int index1, index2, index3, index4, index5,index6;
        index1 = index2 = index3 = index4 = index5 = index6 = 0;
        for (int i = 0; i < splitted.Length; i++)
            if (splitted != null || splitted.Length != 0)
                nums[i] = int.Parse(splitted[i]);                                
        for (int i = 0; i < nums.Length; i++)
            index1 = nums[0];
            index2 = nums[1];
            index3 = nums[2];
            index4 = nums[3];
            index5 = nums[4];
            index6 = nums[5];

        ////spliting pictyureBoxes
        string[] pic0 = pictureBox0.Name.Split(new String[] {"pictureBox"}, 
        for (int i = 0; i< pic0.Length; i++)

        foreach (PictureBox[] item in Controls.)




What does your code do now? What do you want it to do instead?



If I`m rightly understanding, you need something so.
You can place under every digit a picture box. And by clicking on the button or by changing the digit you can change the source of PictureBox by its property Image


yES S. Vladimir your are right but there should be 10 images under every digit and based upon digit I want to show that image
– waqasqureshi
4 hours ago
But for what you need to place 10 images under every digit if you want to show only one? For this purpose I suggest you to change only Source of PictureBox.
I think it will be easier than placing 10 images under every digit and hide/show them
yes please show code for only one image
– waqasqureshi
3 hours ago
Try pictureBox1.Image = Image.FromFile(path);