بســم الله الـرحمــن الرحيــم
السلام عليكــم ورحمـة الله وبركاتــه
تحية طيبة للجميع
:happy:
المهم انظروا إلى هذا الكود
B)
///////////////this button delete qoustions/////////////////
fileName = ComboBox1.SelectedItem //name of fole
Dim num, index, n2, n3 As Integer
Dim s As String
num = CheckedListBox1.SelectedIndex// checkedlistBox contain 3 qoustions
TextBox2.Text &= num
CheckedListBox1.Items.Remove(CheckedListBox1.SelectedItem)
Dim fileCop As New FileStream(fileName & ".txt", FileMode.Open, FileAccess.Read)
fle = New System.IO.StreamReader(fileCop)
str = File.ReadAllLines(fileName & ".txt")
While fle.Peek <> -1
str(index) = fle.ReadLine() // store in array to do delete
index = index + 1
End While
fle.Close()
Dim fileCop1 As New FileStream(fileName & ".txt", FileMode.Open, FileAccess.Write)
fleW = New System.IO.StreamWriter(fileCop1)
s = "" // temp string
If count = 0 Then // if user press the button delete
While n2 < 3 // to swap because I remove Gap mean :: shift
If n2 = num + 2 Then
str(n2) = ""
str(n2) = str(n2 + 1)
End If
'shift /// complete shift
s = str(n2 + 1)
str(n2 + 1) = str(n2)
str(n2) = s
n2 = n2 + 1
End While
While n3 < 8 // to write in file
fleW.WriteLine(str(n3))
n3 = n3 + 1
End While
'*************************************
وكذه لكل الأسئلة
وأما كوينت حاطته في الفورم عشان كل ما ظغط البوتتون ينمسح كويسشن واحد فقط
وأما النم حاطتها عشان تشوف الإنديكس من التشيكد ليست
يعني إذا اختار السؤال الأول ترجع نم صفر ......... وهكذا
المشكله ؟؟ إنه في الفايل ماينمسح شي بس يصير سطر فاضي مدري ليش ؟؟؟وأححيانا يمسح العناصر الأولى في الفايل؟؟؟
أتمنى توضيح السبب
وألــــــــــــــــف شكر للجميع :wub: :wub: <<<أدري طولت الموضوع