|
plz help me in designing a sample dictionary in my own language.
Is it a simple database project where the laxicon file is the data base of words.or any thing else?
|
|
|
|
|
I think I had this assignment at uni a long time ago...
Start with a collection of words. Get someone to enter a word. Check your collection - if the word isn't there, prompt to add the word to the dictionary. If the word is there, let them know it's found. Simple.
-------------------------------------------
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Just bugger off and leave me alone!!
|
|
|
|
|
ThanX for ur responce.
can you tell me,how i'll develop the collection of words.Is this a separate file.As in data base project the data base file(eg in MS Access).
how i'll make that file.i mean what i need to develop that file.
please help me.
|
|
|
|
|
Hello,
I have created one Image Uploader application which uploads jpg images to specified server. What i am doing is Reading the File Content in binary and add http header then send the file content and http header throgh http request. currently i am using Winsock control to send the request. It works fine in English OS(XP) but when try to upload from chinese OS(XP) it upload the image and shows that upload sucess but the uploaded image is get currupted, its file size is reduced and when i try to see the property of the uploaded image, it shows that the Type and Size property are missing. I am using MIME type as "image/jpeg" in http header. i also try to send the request through Internet Explorer Control, but problem remain same. can anybody suggest what is the problem? is problem in reading file or anything else???
I try to use charset as utf-8 in http header, also try to send data in byte array instead of string but still problem remain same..
|
|
|
|
|
Without seeing the code you're using to put this upload together, it's impossible to tell you anything about what might be wrong.
If this is an ASP.NET app, why aren't you using the FileUpload control??
|
|
|
|
|
Hello guyz,
anyone know any safe way to protect our source code from hacker?
hacker can convert EXE file to its source code files it make me worry .
anyone know about it?
....
Can't say anything
.....
|
|
|
|
|
Thats a great wonder.. how to convert EXE/DLL file into source code?
I have never listen that it is possible to convert machine code into human language.
|
|
|
|
|
There are disassemblers for Managed Code. I think he is asking regarding that. Isn't it?
|
|
|
|
|
Good question.
My first answer would be a question - why would anyone want to convert your exe/dll code given how difficult this is to do(see below)?
The answer is yes it is possible to decode an exe/dll from .NET
This is because .NET is machine independent.
What this means is that when you compile your code the exe produced is in CIL format (Common intermediate language).
When the code is run the exe is compiled properly for the machine so that it runs optimally on that particular machine. This is called JIT (just in time compilation)and is performed by the jitter - so I guess having lots of programs running wil give your computer the jitters
The .Net framework basically compiles a second time at runtime even though you thought you had already compiled the code.
There is a program which can decode an exe - however I imagine the result is rather difficult to read.
Strangely enough I was reading about this last night so it is still fresh on my mind.
I hope this is of help
You always pass failure on the way to success.
|
|
|
|
|
In the real world, this is very unlikely to happen IMO. You can buy an obsfucator if you want.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, I have develop an application in vb2005. some part of my application contain numeric up down control. i want to prevent the user from typing in that control and just allow them to use the up down arrow only. I try to set the code in keypress event e.handle=true but the user can use the delete key to delete value. Finally what i want is totally prevent the user from typing anything in this numeric up down control. Thank in advance!!!
|
|
|
|
|
Use a label for your control instead of a text box. Then when the user clicks the up/down arrow, update the text/caption of the label.
-------------------------------------------
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Just bugger off and leave me alone!!
|
|
|
|
|
_Damian S_ wrote: Use a label for your control instead of a text box
How could i use a label control instead of the text box? because when i drag this numeric up down control on the form, it already display a textbox with an arrow key.
|
|
|
|
|
Ah... I thought you were writing your own custom control using a text box and two buttons...
-------------------------------------------
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Just bugger off and leave me alone!!
|
|
|
|
|
No, I didn't develop my own control. This control is the built in control in vb2005. Do you have any other idea to the question that I asked in the previous message?
|
|
|
|
|
There's no way to do it in the stock control. You'd have to "roll your own" to get this kind of functionality.
|
|
|
|
|
I have been given the following spec.
Task: Create a Database access class for your project. This class represents middle tier (business logic) that access a database.
Deliverable:
* Create a method that returns a datareader. This method should take a SQL statement (select * from person). The method itself should do everything else. Return the datareader. You can instantiate this class and assign it to the datasource just before the data bind like this:
dg1.datasource=myDBClass.getDataReader("Select * from person")
* Create a method that returns a dataset. Remember that the dataset can hold multiple tables. So for this method you should be able to either pass it an array of select statements or be able to call the method more than once. In either case, you will need a SQL statement, the dataset you want to populate, and what you want to call the table in the dataset.
* Create a method that returns a true or false after attempt to before an update, insert, or delete. Each of these items do not return a resultset; therefore, use a try/catch block to see if it completes.
I have only been programming in vb for about 2 1/2 weeks, so this has me riddled. Can someone help, or at least point me in the right direction. Are there any examples on Code Project?
Thanks,
|
|
|
|
|
ddtayl06 wrote: I have only been programming in vb for about 2 1/2 weeks
Pretty advanced task requirement for someone with only 2 1/2 weeks programming experience. Homework project, I suspect?
"Try asking what you want to know, rather than asking a question whose answer you know." - Christian Graus
|
|
|
|
|
This doesn't pass the "sniff test" for homework. 2.5 weeks of "class" and you've been given this assignment?? I don't think so.
Though this is very easy to put together, given a short breakdown of the problem.
You're writing a Method that returns a DataReader. This method will take an SQL statement as a String argument.
You're writing another method that takes three arguments, an SQL statement, a DataSet, and a name for a table in that DataSet.
The first sentance in the third point makes no sense.
|
|
|
|
|
I've created and compliled an assembly from a text string using vbcodeprovider and am able to get the results back from it. But I'm missing something critical -- how do I pass data from my running program to that assembly? I'd like to pass for instance a couple of arrays that the code in the assembly will modify.
Thanks as always!
|
|
|
|
|
Oh, sorry, I think you have to compile the assembly and then run it, passing the parameter(s) to it on the run.
|
|
|
|
|
I used an online translator to translate some c# code to vb.net. Anyways all of my events for my main form seem to be giving me this error.
Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
Here's one example of part of the code with the problem:
Private Sub buttonSoundfile_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles buttonSoundfile.Click<br />
OnCreateSoundFile()<br />
End Sub
If anybody has an idea what could be causing this it would be a big help. I will post the complete code for the form in the next message just incase that helps.
|
|
|
|
|
'---------------------------------------------------------------------------- <br />
' File: Main.cs <br />
' <br />
' Copyright (c) Microsoft Corp. All rights reserved. <br />
'----------------------------------------------------------------------------- <br />
Imports System<br />
Imports System.IO<br />
Imports System.Drawing<br />
Imports System.Windows.Forms<br />
Imports System.Threading<br />
Imports Microsoft.DirectX<br />
Imports Microsoft.DirectX.DirectSound<br />
<br />
Public Class MainForm<br />
Inherits Form<br />
Private labelMainInputformatText As Label<br />
Private checkboxRecord As CheckBox<br />
Private buttonSoundfile As Button<br />
Private labelFilename As Label<br />
Private labelStatic As Label<br />
<br />
Public PositionNotify As BufferPositionNotify() = New BufferPositionNotify(NumberRecordNotifications) {}<br />
Public Const NumberRecordNotifications As Integer = 16<br />
Public NotificationEvent As AutoResetEvent = Nothing<br />
Public applicationBuffer As CaptureBuffer = Nothing<br />
Public CaptureDeviceGuid As Guid = Guid.Empty<br />
Public applicationDevice As Capture = Nothing<br />
Private FileName As String = String.Empty<br />
Public applicationNotify As Notify = Nothing<br />
Private NotifyThread As Thread = Nothing<br />
Private WaveFile As FileStream = Nothing<br />
Private Writer As BinaryWriter = Nothing<br />
Private Path As String = String.Empty<br />
Public CaptureBufferSize As Integer = 0<br />
Public NextCaptureOffset As Integer = 0<br />
Private Recording As Boolean = False<br />
Public InputFormat As WaveFormat<br />
Private SampleCount As Integer = 0<br />
Public NotifySize As Integer = 0<br />
Private Capturing As Boolean = False<br />
<br />
<STAThread()> _<br />
Public Shared Sub Main()<br />
Try<br />
Using form As New MainForm()<br />
form.ShowDialog()<br />
End Using<br />
Catch<br />
End Try<br />
End Sub<br />
<br />
Private Sub MainForm_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing<br />
If NotificationEvent IsNot Nothing Then<br />
Capturing = False<br />
NotificationEvent.[Set]()<br />
End If<br />
If applicationBuffer IsNot Nothing Then<br />
If applicationBuffer.Capturing Then<br />
StartOrStopRecord(False)<br />
End If<br />
End If<br />
End Sub<br />
<br />
Public Sub New()<br />
' <br />
' Required for Windows Form Designer support <br />
' <br />
InitializeComponent()<br />
<br />
Dim devices As New DevicesForm(Me)<br />
devices.ShowDialog(Me)<br />
InitDirectSound()<br />
If applicationDevice Is Nothing Then<br />
Close()<br />
Else<br />
Dim formats As New FormatsForm(Me)<br />
If formats.ShowDialog(Me) = DialogResult.OK Then<br />
<br />
labelMainInputformatText.Text = String.Format("{0} Hz, {1}-bit ", InputFormat.SamplesPerSecond, InputFormat.BitsPerSample) + (IIf((1 = InputFormat.Channels), "Mono", "Stereo"))<br />
<br />
CreateCaptureBuffer()<br />
Else<br />
Me.Close()<br />
End If<br />
End If<br />
End Sub<br />
#Region "InitializeComponent code"<br />
Private Sub InitializeComponent()<br />
Me.labelStatic = New System.Windows.Forms.Label<br />
Me.labelMainInputformatText = New System.Windows.Forms.Label<br />
Me.checkboxRecord = New System.Windows.Forms.CheckBox<br />
Me.buttonSoundfile = New System.Windows.Forms.Button<br />
Me.labelFilename = New System.Windows.Forms.Label<br />
Me.SuspendLayout()<br />
'<br />
'labelStatic<br />
'<br />
Me.labelStatic.Location = New System.Drawing.Point(10, 46)<br />
Me.labelStatic.Name = "labelStatic"<br />
Me.labelStatic.Size = New System.Drawing.Size(75, 13)<br />
Me.labelStatic.TabIndex = 0<br />
Me.labelStatic.Text = "Input Format:"<br />
'<br />
'labelMainInputformatText<br />
'<br />
Me.labelMainInputformatText.Location = New System.Drawing.Point(90, 46)<br />
Me.labelMainInputformatText.Name = "labelMainInputformatText"<br />
Me.labelMainInputformatText.Size = New System.Drawing.Size(262, 13)<br />
Me.labelMainInputformatText.TabIndex = 1<br />
'<br />
'checkboxRecord<br />
'<br />
Me.checkboxRecord.Appearance = System.Windows.Forms.Appearance.Button<br />
Me.checkboxRecord.Enabled = False<br />
Me.checkboxRecord.FlatStyle = System.Windows.Forms.FlatStyle.System<br />
Me.checkboxRecord.Location = New System.Drawing.Point(369, 40)<br />
Me.checkboxRecord.Name = "checkboxRecord"<br />
Me.checkboxRecord.Size = New System.Drawing.Size(75, 23)<br />
Me.checkboxRecord.TabIndex = 2<br />
Me.checkboxRecord.Text = "&Record"<br />
'<br />
'buttonSoundfile<br />
'<br />
Me.buttonSoundfile.Location = New System.Drawing.Point(10, 11)<br />
Me.buttonSoundfile.Name = "buttonSoundfile"<br />
Me.buttonSoundfile.Size = New System.Drawing.Size(78, 21)<br />
Me.buttonSoundfile.TabIndex = 3<br />
Me.buttonSoundfile.Text = "Sound &file..."<br />
'<br />
'labelFilename<br />
'<br />
Me.labelFilename.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D<br />
Me.labelFilename.Location = New System.Drawing.Point(96, 11)<br />
Me.labelFilename.Name = "labelFilename"<br />
Me.labelFilename.Size = New System.Drawing.Size(348, 21)<br />
Me.labelFilename.TabIndex = 4<br />
Me.labelFilename.Text = "No file loaded."<br />
Me.labelFilename.TextAlign = System.Drawing.ContentAlignment.MiddleLeft<br />
'<br />
'MainForm<br />
'<br />
Me.AcceptButton = Me.buttonSoundfile<br />
Me.ClientSize = New System.Drawing.Size(454, 77)<br />
Me.Controls.Add(Me.labelStatic)<br />
Me.Controls.Add(Me.labelMainInputformatText)<br />
Me.Controls.Add(Me.checkboxRecord)<br />
Me.Controls.Add(Me.buttonSoundfile)<br />
Me.Controls.Add(Me.labelFilename)<br />
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog<br />
Me.Name = "MainForm"<br />
Me.Text = "CaptureSound3"<br />
Me.ResumeLayout(False)<br />
<br />
End Sub<br />
#End Region<br />
Private Sub InitDirectSound()<br />
CaptureBufferSize = 0<br />
NotifySize = 0<br />
<br />
' Create DirectSound.Capture using the preferred capture device <br />
Try<br />
applicationDevice = New Capture(CaptureDeviceGuid)<br />
Catch<br />
End Try<br />
End Sub<br />
Private Sub CreateCaptureBuffer()<br />
'----------------------------------------------------------------------------- <br />
' Name: CreateCaptureBuffer() <br />
' Desc: Creates a capture buffer and sets the format <br />
'----------------------------------------------------------------------------- <br />
Dim dscheckboxd As New CaptureBufferDescription()<br />
<br />
If applicationNotify IsNot Nothing Then<br />
applicationNotify.Dispose()<br />
applicationNotify = Nothing<br />
End If<br />
If applicationBuffer IsNot Nothing Then<br />
applicationBuffer.Dispose()<br />
applicationBuffer = Nothing<br />
End If<br />
<br />
If 0 = InputFormat.Channels Then<br />
Return<br />
End If<br />
<br />
' Set the notification size <br />
NotifySize = IIf((1024 > InputFormat.AverageBytesPerSecond / 8), 1024, (InputFormat.AverageBytesPerSecond / 8))<br />
NotifySize -= NotifySize Mod InputFormat.BlockAlign<br />
<br />
' Set the buffer sizes <br />
CaptureBufferSize = NotifySize * NumberRecordNotifications<br />
<br />
' Create the capture buffer <br />
dscheckboxd.BufferBytes = CaptureBufferSize<br />
InputFormat.FormatTag = WaveFormatTag.Pcm<br />
dscheckboxd.Format = InputFormat<br />
' Set the format during creatation <br />
applicationBuffer = New CaptureBuffer(dscheckboxd, applicationDevice)<br />
NextCaptureOffset = 0<br />
<br />
InitNotifications()<br />
End Sub<br />
Private Sub InitNotifications()<br />
'----------------------------------------------------------------------------- <br />
' Name: InitNotifications() <br />
' Desc: Inits the notifications on the capture buffer which are handled <br />
' in the notify thread. <br />
'----------------------------------------------------------------------------- <br />
<br />
If applicationBuffer Is Nothing Then<br />
Throw New NullReferenceException()<br />
End If<br />
<br />
' Create a thread to monitor the notify events <br />
If NotifyThread Is Nothing Then<br />
NotifyThread = New Thread(New ThreadStart(AddressOf WaitThread))<br />
Capturing = True<br />
NotifyThread.Start()<br />
<br />
' Create a notification event, for when the sound stops playing <br />
NotificationEvent = New AutoResetEvent(False)<br />
End If<br />
For i As Integer = 0 To NumberRecordNotifications - 1<br />
<br />
<br />
' Setup the notification positions <br />
PositionNotify(i).Offset = (NotifySize * i) + NotifySize - 1<br />
PositionNotify(i).EventNotifyHandle = NotificationEvent.Handle<br />
Next<br />
<br />
applicationNotify = New Notify(applicationBuffer)<br />
<br />
' Tell DirectSound when to notify the app. The notification will come in the from <br />
' of signaled events that are handled in the notify thread. <br />
applicationNotify.SetNotificationPositions(PositionNotify, NumberRecordNotifications)<br />
End Sub<br />
<br />
Private Sub checkboxRecord_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles checkboxRecord.CheckedChanged<br />
Recording = Not Recording<br />
StartOrStopRecord(Recording)<br />
<br />
If Not Recording Then<br />
checkboxRecord.Enabled = False<br />
End If<br />
End Sub<br />
<br />
Private Sub StartOrStopRecord(ByVal StartRecording As Boolean)<br />
'----------------------------------------------------------------------------- <br />
' Name: StartOrStopRecord() <br />
' Desc: Starts or stops the capture buffer from recording <br />
'----------------------------------------------------------------------------- <br />
<br />
If StartRecording Then<br />
' Create a capture buffer, and tell the capture <br />
' buffer to start recording <br />
CreateCaptureBuffer()<br />
applicationBuffer.Start(True)<br />
Else<br />
' Stop the buffer, and read any data that was not <br />
' caught by a notification <br />
applicationBuffer.[Stop]()<br />
<br />
RecordCapturedData()<br />
<br />
Writer.Seek(4, SeekOrigin.Begin)<br />
' Seek to the length descriptor of the RIFF file. <br />
Writer.Write(CInt((SampleCount + 36)))<br />
' Write the file length, minus first 8 bytes of RIFF description. <br />
Writer.Seek(40, SeekOrigin.Begin)<br />
' Seek to the data length descriptor of the RIFF file. <br />
Writer.Write(SampleCount)<br />
' Write the length of the sample data in bytes. <br />
Writer.Close()<br />
' Close the file now. <br />
Writer = Nothing<br />
' Set the writer to null. <br />
' Set the FileStream to null. <br />
WaveFile = Nothing<br />
End If<br />
End Sub<br />
<br />
Private Sub CreateRIFF()<br />
'************************************************************************* <br />
' <br />
' Here is where the file will be created. A <br />
' wave file is a RIFF file, which has chunks <br />
' of data that describe what the file contains. <br />
' A wave RIFF file is put together like this: <br />
' <br />
' The 12 byte RIFF chunk is constructed like this: <br />
' Bytes 0 - 3 : 'R' 'I' 'F' 'F' <br />
' Bytes 4 - 7 : Length of file, minus the first 8 bytes of the RIFF description. <br />
' (4 bytes for "WAVE" + 24 bytes for format chunk length + <br />
' 8 bytes for data chunk description + actual sample data size.) <br />
' Bytes 8 - 11: 'W' 'A' 'V' 'E' <br />
' <br />
' The 24 byte FORMAT chunk is constructed like this: <br />
' Bytes 0 - 3 : 'f' 'm' 't' ' ' <br />
' Bytes 4 - 7 : The format chunk length. This is always 16. <br />
' Bytes 8 - 9 : File padding. Always 1. <br />
' Bytes 10- 11: Number of channels. Either 1 for mono, or 2 for stereo. <br />
' Bytes 12- 15: Sample rate. <br />
' Bytes 16- 19: Number of bytes per second. <br />
' Bytes 20- 21: Bytes per sample. 1 for 8 bit mono, 2 for 8 bit stereo or <br />
' 16 bit mono, 4 for 16 bit stereo. <br />
' Bytes 22- 23: Number of bits per sample. <br />
' <br />
' The DATA chunk is constructed like this: <br />
' Bytes 0 - 3 : 'd' 'a' 't' 'a' <br />
' Bytes 4 - 7 : Length of data, in bytes. <br />
' Bytes 8 -...: Actual sample data. <br />
' <br />
' ************************************************************************** <br />
<br />
<br />
' Open up the wave file for writing. <br />
WaveFile = New FileStream(FileName, FileMode.Create)<br />
Writer = New BinaryWriter(WaveFile)<br />
<br />
' Set up file with RIFF chunk info. <br />
Dim ChunkRiff As Char() = {"R"c, "I"c, "F"c, "F"c}<br />
Dim ChunkType As Char() = {"W"c, "A"c, "V"c, "E"c}<br />
Dim ChunkFmt As Char() = {"f"c, "m"c, "t"c, " "c}<br />
Dim ChunkData As Char() = {"d"c, "a"c, "t"c, "a"c}<br />
<br />
Dim shPad As Short = 1<br />
' File padding <br />
Dim nFormatChunkLength As Integer = 16<br />
' Format chunk length. <br />
Dim nLength As Integer = 0<br />
' File length, minus first 8 bytes of RIFF description. This will be filled in later. <br />
Dim shBytesPerSample As Short = 0<br />
' Bytes per sample. <br />
' Figure out how many bytes there will be per sample. <br />
If 8 = InputFormat.BitsPerSample AndAlso 1 = InputFormat.Channels Then<br />
shBytesPerSample = 1<br />
ElseIf (8 = InputFormat.BitsPerSample AndAlso 2 = InputFormat.Channels) OrElse (16 = InputFormat.BitsPerSample AndAlso 1 = InputFormat.Channels) Then<br />
shBytesPerSample = 2<br />
ElseIf 16 = InputFormat.BitsPerSample AndAlso 2 = InputFormat.Channels Then<br />
shBytesPerSample = 4<br />
End If<br />
<br />
' Fill in the riff info for the wave file. <br />
Writer.Write(ChunkRiff)<br />
Writer.Write(nLength)<br />
Writer.Write(ChunkType)<br />
<br />
' Fill in the format info for the wave file. <br />
Writer.Write(ChunkFmt)<br />
Writer.Write(nFormatChunkLength)<br />
Writer.Write(shPad)<br />
Writer.Write(InputFormat.Channels)<br />
Writer.Write(InputFormat.SamplesPerSecond)<br />
Writer.Write(InputFormat.AverageBytesPerSecond)<br />
Writer.Write(shBytesPerSample)<br />
Writer.Write(InputFormat.BitsPerSample)<br />
<br />
' Now fill in the data chunk. <br />
Writer.Write(ChunkData)<br />
Writer.Write(CInt(0))<br />
' The sample length will be written in later. <br />
End Sub<br />
<br />
Private Sub RecordCapturedData()<br />
'----------------------------------------------------------------------------- <br />
' Name: RecordCapturedData() <br />
' Desc: Copies data from the capture buffer to the output buffer <br />
'----------------------------------------------------------------------------- <br />
Dim CaptureData As Byte() = Nothing<br />
Dim ReadPos As Integer<br />
Dim CapturePos As Integer<br />
Dim LockSize As Integer<br />
<br />
applicationBuffer.GetCurrentPosition(CapturePos, ReadPos)<br />
LockSize = ReadPos - NextCaptureOffset<br />
If LockSize < 0 Then<br />
LockSize += CaptureBufferSize<br />
End If<br />
<br />
' Block align lock size so that we are always write on a boundary <br />
LockSize -= (LockSize Mod NotifySize)<br />
<br />
If 0 = LockSize Then<br />
Return<br />
End If<br />
<br />
' Read the capture buffer. <br />
CaptureData = applicationBuffer.Read(NextCaptureOffset, GetType(Byte), LockFlag.None, LockSize) 'CByte()<br />
<br />
' Write the data into the wav file <br />
Writer.Write(CaptureData, 0, CaptureData.Length)<br />
<br />
' Update the number of samples, in bytes, of the file so far. <br />
SampleCount += CaptureData.Length<br />
<br />
' Move the capture offset along <br />
NextCaptureOffset += CaptureData.Length<br />
NextCaptureOffset = NextCaptureOffset Mod CaptureBufferSize<br />
' Circular buffer <br />
End Sub<br />
<br />
Private Sub buttonSoundfile_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles buttonSoundfile.Click<br />
OnCreateSoundFile()<br />
End Sub<br />
<br />
Private Sub OnCreateSoundFile()<br />
'----------------------------------------------------------------------------- <br />
' Name: OnCreateSoundFile() <br />
' Desc: Called when the user requests to save to a sound file <br />
'----------------------------------------------------------------------------- <br />
<br />
Dim ofd As New SaveFileDialog()<br />
Dim wf As New WaveFormat()<br />
Dim result As DialogResult<br />
<br />
' Get the default media path (something like C:\WINDOWS\MEDIA) <br />
If String.Empty = Path Then<br />
Path = Environment.SystemDirectory.Substring(0, Environment.SystemDirectory.LastIndexOf("\")) + "\media"<br />
End If<br />
<br />
If Recording Then<br />
' Stop the capture and read any data that <br />
' was not caught by a notification <br />
StartOrStopRecord(False)<br />
Recording = False<br />
End If<br />
<br />
ofd.DefaultExt = ".wav"<br />
ofd.Filter = "Wave Files|*.wav|All Files|*.*"<br />
ofd.FileName = FileName<br />
ofd.InitialDirectory = Path<br />
<br />
' Update the UI controls to show the sound as loading a file <br />
checkboxRecord.Enabled = False<br />
labelFilename.Text = "Saving file..."<br />
<br />
' Display the OpenFileName dialog. Then, try to load the specified file <br />
result = ofd.ShowDialog(Me)<br />
<br />
If DialogResult.Abort = result OrElse DialogResult.Cancel = result Then<br />
labelFilename.Text = "Save aborted."<br />
Return<br />
End If<br />
FileName = ofd.FileName<br />
<br />
Try<br />
CreateRIFF()<br />
Catch<br />
labelFilename.Text = "Could not create wave file."<br />
Return<br />
End Try<br />
<br />
' Update the UI controls to show the sound as the file is loaded <br />
labelFilename.Text = FileName<br />
checkboxRecord.Enabled = True<br />
<br />
' Remember the path for next time <br />
Path = FileName.Substring(0, FileName.LastIndexOf("\"))<br />
End Sub<br />
<br />
Private Sub WaitThread()<br />
While Capturing<br />
'Sit here and wait for a message to arrive <br />
NotificationEvent.WaitOne(Timeout.Infinite, True)<br />
RecordCapturedData()<br />
End While<br />
End Sub<br />
<br />
Private Sub labelMainInputformatText_Click(ByVal sender As Object, ByVal e As EventArgs) Handles labelMainInputformatText.Click<br />
<br />
End Sub<br />
<br />
Private Sub labelFilename_Click(ByVal sender As Object, ByVal e As EventArgs) Handles labelFilename.Click<br />
<br />
End Sub<br />
<br />
Private Sub labelStatic_Click(ByVal sender As Object, ByVal e As EventArgs) Handles labelStatic.Click<br />
<br />
End Sub<br />
<br />
End Class
|
|
|
|
|
Post the original C# code and I'll convert it for you.
Right off the bat (and corresponding to the error), you need "WithEvents" on the declaration of buttonSoundfile:
e.g.,
Private WithEvents buttonSoundfile As ...
David Anton
http://www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
C++ to VB Converter: converts C++ to VB
C++ to Java Converter: converts C++ to Java
Instant C++: converts C# to C++/CLI and VB to C++/CLI
|
|
|
|
|
I appreciate your offer to help. There's actually 3 forms with code (no modules or other classes) I'll post them all below. I just showed the main form in the example.
I'd like to understand what withevents is and what's going wrong here though if you could explain.
Thank you very much for your help.
Mike
|
|
|
|
|