1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
| Option Strict On
Imports System.IO
Imports Microsoft.Office.Interop
Public Class Main
#Region "Load"
Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim contactsLocation As String = My.Settings.Contacts
If Not File.Exists(contactsLocation) Then
Exit Sub
End If
Dim contacts = File.ReadAllLines(contactsLocation).Distinct()
For Each contact In contacts
Me.ListBox1.Items.Add(contact)
Next
Me.SetCompleteList(Me.TextBox1, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox2, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox3, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox6, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox7, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox8, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox10, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox11, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox12, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox14, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox15, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox16, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox18, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox19, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox20, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox22, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox23, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox24, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox26, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox27, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox28, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox30, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox31, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox32, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox34, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox35, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox36, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox38, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox39, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox40, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox42, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox43, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox44, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox46, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox47, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox48, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox50, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox51, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox52, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox54, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox55, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox56, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox58, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox59, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox60, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox62, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox63, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox64, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox66, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox67, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox68, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox70, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox71, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox72, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox74, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox75, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox76, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox78, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox79, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox80, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox82, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox83, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox84, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox86, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox87, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox88, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox90, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox91, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox92, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox94, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox95, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox96, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox98, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox99, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox100, Me.ListBox1.Items)
End Sub
Private Sub SetCompleteList(ByVal tb As TextBox, ByVal list As IList)
Dim source As New AutoCompleteStringCollection
For Each item As Object In list
source.Add(item.ToString())
Next item
tb.AutoCompleteCustomSource = source
End Sub
#End Region
#Region "Contacts"
Private Sub Button81_Click(sender As Object, e As EventArgs) Handles Button81.Click
AddNewContact()
End Sub
Private Sub AddNewContact()
If String.IsNullOrEmpty(Me.TextBox101.Text) Then
Exit Sub
End If
Me.ListBox1.Items.Add(Me.TextBox101.Text)
Me.TextBox101.Clear()
Me.SetCompleteList(Me.TextBox1, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox2, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox3, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox6, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox7, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox8, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox10, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox11, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox12, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox14, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox15, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox16, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox18, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox19, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox20, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox22, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox23, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox24, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox26, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox27, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox28, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox30, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox31, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox32, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox34, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox35, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox36, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox38, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox39, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox40, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox42, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox43, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox44, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox46, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox47, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox48, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox50, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox51, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox52, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox54, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox55, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox56, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox58, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox59, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox60, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox62, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox63, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox64, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox66, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox67, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox68, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox70, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox71, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox72, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox74, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox75, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox76, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox78, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox79, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox80, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox82, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox83, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox84, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox86, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox87, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox88, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox90, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox91, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox92, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox94, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox95, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox96, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox98, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox99, Me.ListBox1.Items)
Me.SetCompleteList(Me.TextBox100, Me.ListBox1.Items)
SaveContacts()
End Sub
Private Sub SaveContacts()
If Me.ListBox1.Items.Count = 0 Then
Exit Sub
End If
Dim fileName As String = My.Settings.Contacts
If String.IsNullOrEmpty(My.Settings.Contacts) Then
fileName = String.Format(Application.StartupPath, "Contacts.txt")
End If
Dim sw As New StreamWriter(fileName)
For i As Integer = 0 To Me.ListBox1.Items.Count - 1
sw.WriteLine(Me.ListBox1.GetItemText(Me.ListBox1.Items(i)))
Next
sw.Close()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox101.Text = TextBox101.Text + " URS"
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox101.Text = TextBox101.Text + " LSV"
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
TextBox101.Text = TextBox101.Text + " MSK"
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
TextBox101.Text = TextBox101.Text + " EDO"
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
TextBox101.Text = TextBox101.Text + " LEO"
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
TextBox101.Text = TextBox101.Text + " YAM"
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
If ListBox1.SelectedItem Is Nothing Then
MsgBox("Veuillez sélectionner un client à supprimer.")
Else
ListBox1.Items.Remove(ListBox1.SelectedItem)
SaveContacts()
End If
End Sub
#End Region
#Region "Tabs"
Private Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.Click
TabControl1.SelectedTab = TabPage1
End Sub
Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
TabControl1.SelectedTab = TabPage2
End Sub
Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
TabControl1.SelectedTab = TabPage3
End Sub
Private Sub Button33_Click(sender As Object, e As EventArgs) Handles Button33.Click
TabControl1.SelectedTab = TabPage4
End Sub
Private Sub Button49_Click(sender As Object, e As EventArgs) Handles Button49.Click
TabControl1.SelectedTab = TabPage5
End Sub
#End Region
#Region "Mois"
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
Label78.Text = "JANVIER"
End Sub
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
Label78.Text = "FÉVRIER"
End Sub
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
Label78.Text = "MARS"
End Sub
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
Label78.Text = "AVRIL"
End Sub
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
Label78.Text = "MAI"
End Sub
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
Label78.Text = "JUIN"
End Sub
Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
Label78.Text = "JUILLET"
End Sub
Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
Label78.Text = "AOÛT"
End Sub
Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
Label78.Text = "SEPTEMBRE"
End Sub
Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
Label78.Text = "OCTOBRE"
End Sub
Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click
Label78.Text = "NOVEMBRE"
End Sub
Private Sub Button21_Click(sender As Object, e As EventArgs) Handles Button21.Click
Label78.Text = "DÉCEMBRE"
End Sub
#End Region
#Region "Save To Excel"
Private Sub Button65_Click(sender As Object, e As EventArgs) Handles Button65.Click
Dim fileName1 As String = My.Settings.Doc
Dim SP As String = My.Settings.SavePath
Dim objExcel As New Excel.Application
Dim objWorkbook As Excel.Workbook
Dim objWorksheet As Excel.Worksheet
objWorkbook = objExcel.Workbooks.Open(fileName1, ReadOnly:=False)
objWorksheet = CType(objWorkbook.Worksheets.Item("Feuil1"), Excel.Worksheet)
'This form contains two text boxes, write values to cells A1 and A2
objWorksheet.Cells(1, 1) = TextBox1.Text
objWorksheet.Cells(2, 1) = TextBox2.Text
objWorkbook.Close(False)
objWorkbook.SaveAs(SP, "Book1.xlsx")
objExcel.Quit()
End Sub
#End Region
End Class |
Partager