Vô danh Tiểu tốt
Thành viên tiêu biểu

- Tham gia
- 22/1/14
- Bài viết
- 430
- Được thích
- 547
Tôi sửa đoạn code của bạn thành
Sau một hồi ngấm nghía cuối cùng tôi cũng tìm ra nguyên nhân ở byte thứ 24 (giá trị là 0 chắc là tương đương với dấu kết thúc chuỗi). Thú thật đây là lần thứ 2 trong đời tôi đụng tới VB.Net nên viết lủng củng lắm.
Mã:
[COLOR=#0000ff]dim[/COLOR] ArrMFD() [COLOR=#0000ff]As[/COLOR] [COLOR=#6f002f]Byte[/COLOR]
[COLOR=#0000ff]Dim[/COLOR] MPos [COLOR=#0000ff]As[/COLOR] [COLOR=#6f002f]Long[/COLOR]
[COLOR=#0000ff]Dim[/COLOR] Title [COLOR=#0000ff]As[/COLOR] [COLOR=#6f002f]String[/COLOR] [COLOR=#008000]'Tiêu đề[/COLOR]
[COLOR=#0000ff]Dim[/COLOR] Instrument [COLOR=#0000ff]As[/COLOR] [COLOR=#6f002f]String[/COLOR] [COLOR=#008000]'Loại nhạc cụ[/COLOR]
[COLOR=#0000ff]Dim[/COLOR] MusicName [COLOR=#0000ff]As[/COLOR] [COLOR=#6f002f]String[/COLOR] [COLOR=#008000]'Tên bản nhạc[/COLOR]
[COLOR=#0000ff]Dim[/COLOR] Genre [COLOR=#0000ff]As[/COLOR] [COLOR=#6f002f]String[/COLOR] [COLOR=#008000]'Thể loại[/COLOR]
[COLOR=#0000ff]Dim[/COLOR] KeyWord [COLOR=#0000ff]As[/COLOR] [COLOR=#6f002f]String[/COLOR] [COLOR=#008000]'Từ khóa[/COLOR]
[COLOR=#0000ff]Dim[/COLOR] i [COLOR=#0000ff]As[/COLOR] [COLOR=#6f002f]Long[/COLOR]
[COLOR=#0000ff]Dim[/COLOR] LTitle [COLOR=#0000ff]As[/COLOR] [COLOR=#6f002f]Integer[/COLOR] = 16
[COLOR=#0000ff]Dim[/COLOR] LInstrument [COLOR=#0000ff]As[/COLOR] [COLOR=#6f002f]Integer[/COLOR] = 14
[COLOR=#008000]' With OpenFileDialog1[/COLOR]
[COLOR=#008000]' .Multiselect = False[/COLOR]
[COLOR=#008000]' .Title = "Select MFD file - DHN"[/COLOR]
[COLOR=#008000]' .Filter = "Yamaha music finder database files (*.mfd)|*.mfd|All files (*.*)|*.*"[/COLOR]
[COLOR=#008000]' .FilterIndex = 1[/COLOR]
[COLOR=#008000]' .FileName = ""[/COLOR]
[COLOR=#008000]' .RestoreDirectory = True[/COLOR]
[COLOR=#008000]' If .ShowDialog = Windows.Forms.DialogResult.OK Then[/COLOR]
[COLOR=#008000]' MFDLink = .FileName[/COLOR]
[COLOR=#008000]' End If[/COLOR]
[COLOR=#008000]' End With[/COLOR]
[COLOR=#008000]'If Len(MFDLink) > 0 Then[/COLOR]
ArrMFD = System.IO.File.ReadAllBytes("D:\MusicFinderPreset.mfd")
[COLOR=#008000]'End If[/COLOR]
[COLOR=#008000]'*Chú ý: Phần tử trong mảng luôn bắt đầu từ 0, MPos =0[/COLOR]
[COLOR=#008000]'Tiêu đề File[/COLOR]
[COLOR=#0000ff]For[/COLOR] i = MPos [COLOR=#0000ff]To[/COLOR] MPos + LTitle - 1
Title = Title & ChrW(ArrMFD(i))
MPos = LTitle
[COLOR=#0000ff]Next[/COLOR]
Debug.Print(Title)
[COLOR=#008000]'Loại nhạc cụ[/COLOR]
[COLOR=#0000ff]For[/COLOR] i = MPos [COLOR=#0000ff]To[/COLOR] MPos + LInstrument - 1
Instrument &= [COLOR=#0000ff]IIf[/COLOR](ArrMFD(i)=0, " ", ChrW(ArrMFD(i)))
Debug.Print ("[" & i & "]" & ArrMFD(i) & " - " & ChrW(ArrMFD(i)))
[COLOR=#0000ff]Next[/COLOR]
Debug.Print (Instrument)
Sau một hồi ngấm nghía cuối cùng tôi cũng tìm ra nguyên nhân ở byte thứ 24 (giá trị là 0 chắc là tương đương với dấu kết thúc chuỗi). Thú thật đây là lần thứ 2 trong đời tôi đụng tới VB.Net nên viết lủng củng lắm.
Lần chỉnh sửa cuối: