Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7913051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:45:11+00:00 2026-06-03T13:45:11+00:00

Dim n, front, rear As Integer Dim x As Integer Dim arr() As Integer

  • 0
Dim n, front, rear As Integer
Dim x As Integer
Dim arr() As Integer

Public Function init()
  n = InputBox("Enter size :")
  ReDim arr(n) As Integer
  front = 0
  rear = -1
End Function

Public Function insert(x As Integer)
  If rear = n-1 Then
    MsgBox "queue FULL !!!", vbOKOnly, "QUEUE"
  Else
    rear = rear + 1
    arr(rear) = x
    MsgBox x, vbOKOnly, "INSERTED"
  End If
End Function

Public Function delete() As Integer
  If rear + 1 = front Then
    MsgBox "queue Empty !!!", vbOKOnly, "QUEUE"
  Else
    x = arr(front)
    front = front + 1
    Return x
  End If
End Function

Private Sub inser_Click()
  If rear < n Then
    x = InputBox("Enter element :")
    Call insert(x)
  Else
    MsgBox "queue FULL !!!", vbOKOnly, "QUEUE"
  End If
End Sub

Private Sub del_Click()
  x = delete()
  MsgBox x, vbOKOnly, "DELETED"
End Sub

Private Sub Exit_Click()
  End
End Sub

Private Sub Form_Load()
  Call init
End Sub

This is my code in VB6.
I am getting an error in insert function in Return x line where it says “complier error Expected : End of statement”

One more error is that whenever I try to delete the elements of the queue it shows “0 DELETED”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:45:13+00:00Added an answer on June 3, 2026 at 1:45 pm

    You’re attempting to return a value from a Function by using a Return statement, which is not valid in VB6. In VB6 you return a Function’s value by assigning the return value to the Function’s name.

    So for your delete Function you would write this:

    Public Function delete() As Integer
        If rear + 1 = front Then
            MsgBox "queue Empty !!!", vbOKOnly, "QUEUE"
        Else
            x = arr(front)
            front = front + 1
            delete = x    ' <-- returning x here.
        End If
    End Function
    

    Take a look at your other Functions, they’re not explictly returning values at all.

    It might help to take a look at this, which provides an overview of how Subs and Functions work in VB6.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dim i as integer For i = 0 to 365 sqlinsert.InsertCommand=insert into cashdate (date)
Dim classCodeDetails As List(Of ClassCodeDetail) = db.ClassCodeHeaders.Single(Function(cch) cch.CLCH_ID = classCodeHeaderId ).ClassCodeDetails.ToList() classCodeDetails.Sort(Function(c1, c2) c1.Make.MAKE_English.CompareTo(c2.Make.MAKE_English)
Dim insert_coupon_query As String = (INSERT INTO qa_discountcoupons (id, status_code) VALUES (AUTO_INCREMENT_ID, 5)) Dim
I have an application having front end in ASP.NET (VB.NET) and at back end
I've got a .Net web system with a VB.Net front end talking to a
I have a very simple ASP.Net page that acts as a front end for
Dim xbg As Rm xbg.LobId = cmb_lob.SelectedValue xbg.Mobile = mobno.Text xbg.BusinessFax = faxno.Text xbg.BusinessPhone
Dim objMail As New Mail.MailMessage(no-reply@mywebsite.com, ToEmail, Password Reset, body) ...and the problem is that
Dim MyQuery = From c In xdoc.Descendants() _ Where c.Attribute(OriginY) IsNot Nothing _ Order
dim dataType as String toolTip=Marks And Number[String] I want to get the [String] alone.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.