Results 1 to 3 of 3

Thread: Converting from Delphi to Vb help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2008
    Posts
    353

    Exclamation Converting from Delphi to Vb help

    Hi i got this code and i desperately want to translate it to vb but i cant


    Code:
    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('[IMG]'+edit2.text+'[/IMG]');
     slMSG.Add('');
     slMSG.Add('Playlist:');
     slMSG.Add('
    Code:
    '+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;

  2. #2
    New Member
    Join Date
    Sep 2008
    Posts
    2

    Re: Converting from Delphi to Vb help

    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('');
    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

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2008
    Posts
    353

    Re: Converting from Delphi to Vb help

    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...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width