Advertisement
Guest User

Untitled

a guest
May 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.15 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using Microsoft.Office.Interop.Excel;
  11. using Excel = Microsoft.Office.Interop.Excel;
  12.  
  13. namespace excel
  14. {
  15.     public partial class Form1 : Form
  16.     {
  17.         string img = "C:\\Users\\Artem\\source\\repos\\excel\\images\\";
  18.         public Form1()
  19.         {
  20.             InitializeComponent();
  21.         }
  22.    
  23.      
  24.  
  25.         private void Form1_Load(object sender, EventArgs e)
  26.         {
  27.             Excel excel = new Excel("C:\\Users\\Artem\\source\\repos\\excel\\excel.xlsx", 1);
  28.             label6.Text = excel.ReadCell(0, 0);
  29.             label7.Text = excel.ReadCell(4, 0);
  30.             label8.Text = "An " + excel.ReadCell(4, 0).ToString() + " travels at " + excel.ReadCell(4, 2).ToString() + " so would complete the marathon.";
  31.             int i = 4;
  32.             foreach (Control lbl in groupBox1.Controls) {
  33.        
  34.                     lbl.Text = excel.ReadCell(i, 0);
  35.                     i++;
  36.             }
  37.            
  38.             pictureBox6.SizeMode = PictureBoxSizeMode.StretchImage;
  39.             pictureBox6.Load(img + "f1-car.jpg");
  40.             pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
  41.             pictureBox1.Load(img + excel.ReadCell(4, 1).ToString());
  42.             pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;
  43.             pictureBox2.Load(img + excel.ReadCell(5, 1).ToString());
  44.             pictureBox3.SizeMode = PictureBoxSizeMode.StretchImage;
  45.             pictureBox3.Load(img + excel.ReadCell(6, 1).ToString());
  46.             pictureBox4.SizeMode = PictureBoxSizeMode.StretchImage;
  47.             pictureBox4.Load(img + excel.ReadCell(7, 1).ToString());
  48.             pictureBox5.SizeMode = PictureBoxSizeMode.StretchImage;
  49.             pictureBox5.Load(img + excel.ReadCell(8, 1).ToString());
  50.  
  51.  
  52.  
  53.  
  54.         }
  55.  
  56.         private void pictureBox1_Click(object sender, EventArgs e)
  57.         {
  58.             if(radioButton1.Checked == true)
  59.             {
  60.                 dfs
  61.             }
  62.         }
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement