Сохранение и редактирование файла через listbox и textbox - VB
Формулировка задачи:
Доброго времени суток!
я в ступоре, голова дальше не варит...
даны 2 textbox, 1 listbox и 3 кнопки.
с созданием текстового файла вроде разобрался,а вот как выбрать созданный файл и редактировать его не доходит до меня. по пробовал через массив- ругается.
Ребят, я пока очень очень новичок, не серчайте сильно..
скрин прилагается
Public i As Integer Dim k As Integer Dim n As Integer Dim mass(1 To 150) As String Private Sub cmdOtkrF_Click() Open File1 For Input As #1 Line Input #1, mass(1) Line Input #1, mass(2) Line Input #1, mass(3) Line Input #1, mass(4) Line Input #1, mass(5) Line Input #1, mass(6) Line Input #1, mass(7) Line Input #1, mass(8) Line Input #1, mass(9) Line Input #1, mass(10) Line Input #1, mass(11) Line Input #1, mass(12) Line Input #1, mass(13) Line Input #1, mass(14) Line Input #1, mass(15) Line Input #1, mass(16) Line Input #1, mass(17) Line Input #1, mass(18) Line Input #1, mass(19) Line Input #1, mass(20) Line Input #1, mass(21) Line Input #1, mass(22) Line Input #1, mass(23) Line Input #1, mass(24) Line Input #1, mass(25) Line Input #1, mass(26) Line Input #1, mass(27) Line Input #1, mass(28) Line Input #1, mass(29) Line Input #1, mass(30) Line Input #1, mass(31) Line Input #1, mass(32) Line Input #1, mass(33) Line Input #1, mass(34) Line Input #1, mass(35) Line Input #1, mass(36) Line Input #1, mass(37) Line Input #1, mass(38) Line Input #1, mass(39) Line Input #1, mass(40) Line Input #1, mass(41) Line Input #1, mass(42) Line Input #1, mass(43) Line Input #1, mass(44) Line Input #1, mass(45) Line Input #1, mass(46) Line Input #1, mass(47) Line Input #1, mass(48) Line Input #1, mass(49) Line Input #1, mass(50) Line Input #1, mass(51) Line Input #1, mass(52) Line Input #1, mass(53) Line Input #1, mass(54) Line Input #1, mass(55) Line Input #1, mass(56) Line Input #1, mass(57) Line Input #1, mass(58) Line Input #1, mass(59) Line Input #1, mass(60) Line Input #1, mass(61) Line Input #1, mass(62) Line Input #1, mass(63) Line Input #1, mass(64) Line Input #1, mass(65) Line Input #1, mass(66) Line Input #1, mass(67) Line Input #1, mass(68) Line Input #1, mass(69) Line Input #1, mass(70) Line Input #1, mass(71) Line Input #1, mass(72) Line Input #1, mass(73) Line Input #1, mass(74) Line Input #1, mass(75) Line Input #1, mass(76) Line Input #1, mass(77) Line Input #1, mass(78) Line Input #1, mass(79) Line Input #1, mass(80) Line Input #1, mass(81) Line Input #1, mass(82) Line Input #1, mass(83) Line Input #1, mass(84) Line Input #1, mass(85) Line Input #1, mass(86) Line Input #1, mass(87) Line Input #1, mass(88) Line Input #1, mass(89) Line Input #1, mass(90) Line Input #1, mass(91) Line Input #1, mass(92) Line Input #1, mass(93) Line Input #1, mass(94) Line Input #1, mass(95) Line Input #1, mass(96) Line Input #1, mass(97) Line Input #1, mass(98) Line Input #1, mass(99) Line Input #1, mass(100) Line Input #1, mass(101) Line Input #1, mass(102) Line Input #1, mass(103) Line Input #1, mass(104) Line Input #1, mass(105) Line Input #1, mass(106) Line Input #1, mass(107) Line Input #1, mass(108) Line Input #1, mass(109) Line Input #1, mass(110) Line Input #1, mass(111) Line Input #1, mass(112) Line Input #1, mass(113) Line Input #1, mass(114) Line Input #1, mass(115) Line Input #1, mass(116) Line Input #1, mass(117) Line Input #1, mass(118) Line Input #1, mass(119) Line Input #1, mass(120) Line Input #1, mass(121) Line Input #1, mass(122) Line Input #1, mass(123) Line Input #1, mass(124) Line Input #1, mass(125) Line Input #1, mass(126) Line Input #1, mass(127) Line Input #1, mass(128) Line Input #1, mass(129) Line Input #1, mass(130) Line Input #1, mass(131) Line Input #1, mass(132) Line Input #1, mass(150) Close #1 End Sub Private Sub cmdSoxrF_Click() i = i + 1 mass(150) = i Open File1 For Output As #1 Print #1, mass(1) Print #1, mass(2) Print #1, mass(3) Print #1, mass(4) Print #1, mass(5) Print #1, mass(6) Print #1, mass(7) Print #1, mass(8) Print #1, mass(9) Print #1, mass(10) Print #1, mass(11) Print #1, mass(12) Print #1, mass(13) Print #1, mass(14) Print #1, mass(15) Print #1, mass(16) Print #1, mass(17) Print #1, mass(18) Print #1, mass(19) Print #1, mass(20) Print #1, mass(21) Print #1, mass(22) Print #1, mass(23) Print #1, mass(24) Print #1, mass(25) Print #1, mass(26) Print #1, mass(27) Print #1, mass(28) Print #1, mass(29) Print #1, mass(30) Print #1, mass(31) Print #1, mass(32) Print #1, mass(33) Print #1, mass(34) Print #1, mass(35) Print #1, mass(36) Print #1, mass(37) Print #1, mass(38) Print #1, mass(39) Print #1, mass(40) Print #1, mass(41) Print #1, mass(42) Print #1, mass(43) Print #1, mass(44) Print #1, mass(45) Print #1, mass(46) Print #1, mass(47) Print #1, mass(48) Print #1, mass(49) Print #1, mass(50) Print #1, mass(51) Print #1, mass(52) Print #1, mass(53) Print #1, mass(54) Print #1, mass(55) Print #1, mass(56) Print #1, mass(57) Print #1, mass(58) Print #1, mass(59) Print #1, mass(60) Print #1, mass(61) Print #1, mass(62) Print #1, mass(63) Print #1, mass(64) Print #1, mass(65) Print #1, mass(66) Print #1, mass(67) Print #1, mass(68) Print #1, mass(69) Print #1, mass(70) Print #1, mass(71) Print #1, mass(72) Print #1, mass(73) Print #1, mass(74) Print #1, mass(75) Print #1, mass(76) Print #1, mass(77) Print #1, mass(78) Print #1, mass(79) Print #1, mass(80) Print #1, mass(81) Print #1, mass(82) Print #1, mass(83) Print #1, mass(84) Print #1, mass(85) Print #1, mass(86) Print #1, mass(87) Print #1, mass(88) Print #1, mass(89) Print #1, mass(90) Print #1, mass(91) Print #1, mass(92) Print #1, mass(93) Print #1, mass(94) Print #1, mass(95) Print #1, mass(96) Print #1, mass(97) Print #1, mass(98) Print #1, mass(99) Print #1, mass(100) Print #1, mass(101) Print #1, mass(102) Print #1, mass(103) Print #1, mass(104) Print #1, mass(105) Print #1, mass(106) Print #1, mass(107) Print #1, mass(108) Print #1, mass(109) Print #1, mass(110) Print #1, mass(111) Print #1, mass(112) Print #1, mass(113) Print #1, mass(114) Print #1, mass(115) Print #1, mass(116) Print #1, mass(117) Print #1, mass(118) Print #1, mass(119) Print #1, mass(120) Print #1, mass(121) Print #1, mass(122) Print #1, mass(123) Print #1, mass(124) Print #1, mass(125) Print #1, mass(126) Print #1, mass(127) Print #1, mass(128) Print #1, mass(129) Print #1, mass(130) Print #1, mass(131) Print #1, mass(132) Print #1, mass(150) Close #1 End Sub Private Sub cmdSozdF_Click() Open txt2 + ".txt" For Output As #1 Close #1 txt2.Text = "" End Sub Private Sub File1_Click() k = 0 n = 0 Text1 = k End Sub Private Sub Form_Load() ChDir "C:\Users\Комп\Desktop\RUS\темы" End Sub Private Sub lblTip_Click() End Sub
Решение задачи: «Сохранение и редактирование файла через listbox и textbox»
textual
Листинг программы
Private Sub cmdOtkrF_Click() Open "C:\WINDOWS\system32\eula.txt" For Input As #1 txtVvodVoprosa = Input(LOF(1), #1) Close #1 End Sub Private Sub cmdSoxrF_Click() Open "C:\WINDOWS\system32\eula.txt" For Output As #1 Print #1, txtVvodVoprosa Close #1 End Sub
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д