Help needed converting visual basic code to delphi

Hi I want to redo an app I made in visual basic in delphi so that I can add alot more features to it

heres the vb code

Private Sub Command1_Click()
Dim flags, targetframename, postdata, url, ref As String
flags = 1
targetframename = ""
postdata = ""
url = Text2.Text
ref = Text1.Text
headers = "Referer: " & ref & 10 & 13
WebBrowser1.Navigate url, flags, targetframename, postdata, headers

End Sub

heres what I have in delphi

procedure TForm1.Button1Click(Sender: TObject);
begin
flags := '1';
targetframename := '';
postdata := '';
url := labelededit1.Text;
ref := labelededit2.Text;
headers := 'Referer: ' + ref + '10' + '13';
webbrowser1.Navigate(url, flags, targetframename, postdata, headers);
end;

In delphi I get the following compile error though

[Error] Unit1.pas(39): There is no overloaded version of 'Navigate' that can be called with these arguments

Any help on this would be apreciated
Thanks

Comments

  • : Hi I want to redo an app I made in visual basic in delphi so that I
    : can add alot more features to it
    :
    : heres the vb code
    :
    : Private Sub Command1_Click()
    : Dim flags, targetframename, postdata, url, ref As String
    : flags = 1
    : targetframename = ""
    : postdata = ""
    : url = Text2.Text
    : ref = Text1.Text
    : headers = "Referer: " & ref & 10 & 13
    : WebBrowser1.Navigate url, flags, targetframename, postdata,
    : headers
    :
    : End Sub
    :
    : heres what I have in delphi
    :
    : procedure TForm1.Button1Click(Sender: TObject);
    : begin
    : flags := '1';
    : targetframename := '';
    : postdata := '';
    : url := labelededit1.Text;
    : ref := labelededit2.Text;
    : headers := 'Referer: ' + ref + '10' + '13';
    : webbrowser1.Navigate(url, flags, targetframename, postdata,
    : headers);
    : end;
    :
    : In delphi I get the following compile error though
    :
    : [Error] Unit1.pas(39): There is no overloaded version of 'Navigate'
    : that can be called with these arguments
    :
    : Any help on this would be apreciated
    : Thanks
    :
    What kind of types did you give the various variables? For the Navigate() call to work the types must match perfectly. See helpfiles for the exact types.
  • I gave up on this at the time but came back to it yesterdaqy I took a break off programming for quite some time but thought Id update with the working code

    procedure TForm1.Button1Click(Sender: TObject);

    var
    Flags, Headers, TargetFrameName, PostData: OleVariant;
    Url, Ref: string;

    begin
    flags := '1';
    targetframename := '';
    postdata := '';
    url := labelededit2.Text;
    ref := labelededit1.Text;
    headers := 'Referer: ' + ref + #10 + #13;
    webbrowser1.Navigate(url, flags, targetframename, postdata, headers);
    end;
  • Hi,
    The error message is not that self-explanatory for a new user.

    This (error message)means you are accessing a method "Navigate" for object "webbrowser1" which have different number parameters types or count that you are passing than the original declaration.

    For emample,
    There is a object MyObject which have Add method like below:

    MyObject = Class
    function Add(a: Integer; b: Integer) : Integer; Overload;
    function Add(a: Integer; b: Integer; c: Integer) : Integer; Overload;
    end;

    Here in this example, you can call "Add" method with either two or three parameters. It will do the job of addition. (For that you have to write the code... :))

    In your problem, there might be no such method "webbrowser1.Navigate" with the number of input parametes or data type of some of them might be different to the original declaration.

    Still you have any doubt, please revert...

    Abhijeet Patil.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories