What is the replacement for BEEP() in VS ?

  • Thread starter Thread starter Peter Stojkovic
  • Start date Start date
P

Peter Stojkovic

I am now using Beep to make a short warning-sound in my VB-Project
What is the aeqivalent command in VS.70, if i dont want use Visual Basic
Run-Time Library Members

Thanks Peter
 
Peter,

Why you ask this when you don't want to use VBNet this in this newsgroup. Is
than the newsgroup for CSharp, JSharp or VC not more the newsgroup where you
ask this depending on the language you are using?

Cor
 
I am using VS 70 with VB
But i dont wnat use the old fashioned commands from VB 6.0
I only want use the NEW commands from VS.VB

Peter
 
Peter,
But i dont wnat use the old fashioned commands from VB 6.0
I only want use the NEW commands from VS.VB

There are not much replacements that I know.
The If, Else, + - * \ / ^ are complete the same as in VBclassic, VBA and
VBS.

Or do you mean commands as OrElse and AndAlso, there are not much like that.

I think that it is almost impossible to write a program without those I
showed first.

How do you do that?

Cor
 
This is one sample it's in C#.

using System.Runtime.InteropServices;

class Message
{
[DllImport("kernel32.dll")]
public static extern bool Beep(int Frequency, int Duration);

public static void Main()
{
Beep(220, 250);
}
}

The Beep API doesn't always work on all PC's , depends how the PC is setup.
The
MessageBeep is more reliable:

Public Enum MessageBeepEnum
Simple = -1
OK = &H0&
Hand = &H10&
Question = &H20&
Exclamation = &H30&
Asterisk = &H40
End Enum

Public Declare Function MessageBeep Lib "user32"(ByVal Beep As
MessageBeepEnum) As Int32

Hope this helps you.
 
Hi Cor

I need ONLY the function or sub in VS.VB that makes the same like in
earlier times the "beep()"
to give the user the info, there is a wrong input for example.

What is the new "beep()"-function.

I dont want use "beep", I want use the new function, the name i am looking
for

Peter
 
Windows Forms Tips and Tricks has an article on using sound. Code is in VB
or C#.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Peter Stojkovic said:
I am now using Beep to make a short warning-sound in my VB-Project
What is the aeqivalent command in VS.70, if i dont want use Visual Basic
Run-Time Library Members

There is no managed replacement available. BTW: I strongly recommend to
rethink the decision to use only a part of Visual Basic .NET.
 
The idea was not use OLD (OUTDATED) parts of VB.NET, that are cutted in next
release by microsoft.
Peter
 
Peter,

Any idea why Microsoft would do that. AFAIK is VBx the most used programming
language on PC.

Or do you have information that we oversee in this newsgroup? Because that
can really be interesting.

Cor
 
Peter,
The new method from VB.NET is oddly enough Beep also.

If you want to use Beep in C#, add a reference to Microsoft.VisuaBasic.dll,
then use Microsoft.VisuaBasic.Interaction.Beep.

Alternatively you can use a Win32 API as Pipo shows, if you need the extra
parameters...

Hope this helps
Jay
 
Peter,
The Microsoft.VisualBasic namespace is an integral part of VB.NET (and
..NET), types here will not be "cut".

The Microsoft.VisualBasic.Compatibility namespace is used in converted
projects, types here "should" only be used for projects converted from VB6.
I would not expect types here to be "cut" either.

http://msdn.microsoft.com/library/d...isualBasicCompatibilityNamespaceReference.asp


The Microsoft.VisualBasic.Compatibility namespace is wholly contained in the
Microsoft.VisualBasic.Compatibility.dll, this dll is not normally deployed,
hence using it requires you to include it in your setup project. Where as
the Microsoft.VisualBasic namespace is wholly contained in the
Microsoft.VisualBasic.dll, which is installed as part of the framework
itself...


Beep is in the Interaction module in the Microsoft.VisualBasic namespace.
Ergo its safe to use.

Hope this helps
Jay

Peter Stojkovic said:
The idea was not use OLD (OUTDATED) parts of VB.NET, that are cutted in
next release by microsoft.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top