PDA

Click to See Complete Forum and Search --> : Converting from Delphi to Vb help


batori
Aug 27th, 2008, 01:49 PM
Hi i got this code and i desperately want to translate it to vb but i cant :(



procedure TForm1.Button3Click(Sender: TObject);
var
sURL:String;
slEintrag:TStringList;
url:string;
sNick,sPW:string;
strs,slMSG:tstringlist;
begin
button3.Enabled:=false;
sNick:= Nick2;
sPW:= PW2;

slEintrag := TStringList.Create;
sURL:='http://www.forum.org/login.php';
with
slEintrag do
begin
Values['username'] := sNick;
Values['password'] := sPW;
Values['autologin'] := 'on';
Values['redirect'] := '';
Values['login'] := 'Log+in';
end;
try
memo3.Text:=idhttp1.Post(sURL,slEintrag);
idhttp1.CookieManager.AddCookie(idhttp1.Response.RawHeaders.Text,'forum.org');
except
MessageDlg('Senden error', mtError, [mbOK], 0);
end;
slEintrag.Free;

slMSG:= TStringList.Create;
slMSG.Add(''+edit1.text+'');
slMSG.Add('');
slMSG.Add(''+edit2.text+'');
slMSG.Add('');
slMSG.Add('Playlist:');
slMSG.Add(''+memo1.Text+'');
slMSG.Add(''+memo2.Text+'');
slMSG.Add('');
slMSG.Add('Download:');
slMSG.Add(''+memo3.Text+'');

url:='http://forum.org/posting.php';
strs := TStringList.Create;
strs.clear;

strs.add('subject='+edit1.text);
strs.add('addbbcode18=#');
strs.add('addbbcode20=12');
strs.add('helpbox=Font color: text Tip: you can also use color=#FF0000');
strs.add('message='+slMSG.Text);
strs.add('poll_title=');
strs.add('add_poll_option_text=');
strs.add('poll_length=');
strs.add('mode=newtopic');
strs.add('f=17');
// strs.add('f='+edit3.Text);
strs.add('post=Submit');

idhttp1.Post(url,strs);

button3.Enabled:=true;

end;

everto
Sep 3rd, 2008, 11:14 PM
hey..i dont know delphi AT ALL...but im just ogin to go through and atleast give what i believe this may translate too...

Private Sub Button3_Click()
dim sURL as String
dim slEintrag as TStringList 'dont know what tstringlist would be
dim url as string
dim sNick,sPW as string
dim strs,slMSG as tstringlist 'again dont know what it means

button3.Enabled:=false 'so that you cant click it no more
sNick= Nick2 'im guessing Nick2 is a textbox so nick2.text
sPW= PW2 'im guessing PW2 is a textbox so pw2.text

slEintrag = TStringList.Create 'this idk still
sURL ='http://www.forum.org/login.php' 'you can set the url here
with
slEintrag doevents
begin
Values['username'] := sNick
Values['password'] := sPW
Values['autologin'] := 'on'
Values['redirect'] := ''
Values['login'] := 'Log+in'
end;
try
memo3.Text=idhttp1.Post(sURL,slEintrag)

'//////////////yea im getting lost now sorry..if i knew more of the project, i could reverse engineer it for ya...try emailing me and i'll help ya\\\\\\'
idhttp1.CookieManager.AddCookie(idhttp1.Response.RawHeaders.Text,'forum.org');
except
MessageDlg('Senden error', mtError, [mbOK], 0);
end;
slEintrag.Free;

slMSG:= TStringList.Create;
slMSG.Add(''+edit1.text+'');
slMSG.Add('');
slMSG.Add(''+edit2.text+'');
slMSG.Add('');
slMSG.Add('Playlist:');
slMSG.Add('


'+memo1.Text+'

');
slMSG.Add(''+memo2.Text+'');
slMSG.Add('');
slMSG.Add('Download:');
slMSG.Add('
Code:

'+memo3.Text+'

');

url:='http://forum.org/posting.php';
strs := TStringList.Create;
strs.clear;

strs.add('subject='+edit1.text);
strs.add('addbbcode18=#');
strs.add('addbbcode20=12');
strs.add('helpbox=Font color: text Tip: you can also use color=#FF0000');
strs.add('message='+slMSG.Text);
strs.add('poll_title=');
strs.add('add_poll_option_text=');
strs.add('poll_length=');
strs.add('mode=newtopic');
strs.add('f=17');
// strs.add('f='+edit3.Text);
strs.add('post=Submit');

idhttp1.Post(url,strs);

button3.Enabled:=true;

end;


End Sub

batori
Sep 11th, 2008, 03:42 AM
well actually i maged to translate some of the code...i can get it to save cookies...but i hope i will make it work...