PDA

View Full Version : راهنمائی در مورد نوشتن و خواندن از text



karimi84
دوشنبه 02 آبان 1384, 22:27 عصر
سلام
فرمی توسط کاربر پر می شود می خوام که وقتی ان را ذخیره کرد در یک فایل text ذخیره کند
حالا برای برای خوانی از یک text می خواند و در مقادیر در برنامه در فیلدها مخصوص به خود باید قرار بگیرد
برای انجام این دو کار چطور باید عمل کنم
لطفا راهنمای کنید
مرسی

zarrin_306
سه شنبه 03 آبان 1384, 03:58 صبح
از کد زیر استفاده کن
public structure iran
dim code as integer
dim name as string
dim family as string
end structure
idim iran1 as iran
din filenum as integer

ذخیره اطلاعات در رکورد مورد نظر
private sub setfields
iran1.code=textbox1.text
iran1.name =textbox2.text
iran1.family=textbox3.text
end sub

فراخوانی مشخصات در جای خود
private sub restorefields
textbox1.text=iran1.code
textbox2.text=iran1.name
textbox3.text=iran1.family
end sub
private sub clearing
textbox1.clear
textbox2.clear
textbox3.clear
end sub
در فرم کد زیر را وارد کن
filenum=freefile
if iran1.code>0 then
fileopen(filenum,"iran.txt",openmode.random,,,30000
end if
در دکمه ذخیره
call setfields
if iran1.code>0 then
fileput(filrnum,iran1,iran1.code
end if
call clearing
در دکمه فراخوان
dim code1 as integer
((code1=val (inputbox("enter code"

seek(filenum,code1
fileget(filenum,code1
call restorefields