Hi Ladies and Gents,
I am new to VS2012, and used VB6 eons ago.
I have been asked to create a program to record serial data and audio data (from Multiple sources).
I was wondering if a DLL is the way to go and if it can do what i need it to.
Firstly i need a DLL to record the serial data to hard drive, with methods to set Baudrate, com port and data bits etc
i created a DLL see code below:
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
i found when i send the updateSettings from a Windows Forms program the response comes back Complete, but when i use the getSettings method the response is always 9600 no matter what i change it to with the updateSettings method.
Does the DLL not retain the settings for the serialPort1???
Also i have to record audio from multiple sources and wondered if i could create a DLL to record audio to hard drive and then run multiple instances of it depending on the number of microphones fitted???
Any help would be much appreciated
Regards
Stu
	
		
			
		
		
	
				
			I am new to VS2012, and used VB6 eons ago.
I have been asked to create a program to record serial data and audio data (from Multiple sources).
I was wondering if a DLL is the way to go and if it can do what i need it to.
Firstly i need a DLL to record the serial data to hard drive, with methods to set Baudrate, com port and data bits etc
i created a DLL see code below:
			
				PHP:
			
		
		
		Public Class SerialData
    Dim WithEvents SerialPort1 As New System.IO.Ports.SerialPort
    Public Function UpdateSettings(ByVal Port As String, ByVal baudSpeed As Integer, ByVal dataBits As Integer, _
                                   ByVal parity As System.IO.Ports.Parity, ByVal stopBits As System.IO.Ports.StopBits)
On Error GoTo notSet
        Dim result As String = "Error"
        SerialPort1.PortName = Port
        SerialPort1.BaudRate = baudSpeed
        SerialPort1.DataBits = dataBits
        SerialPort1.StopBits = stopBits
        SerialPort1.Parity = parity
        result = "Complete"
notset:
        Return result
    End Function
    Public Function getSettings()
        Dim result As String
        result = SerialPort1.BaudRate
        Return result
    End Function
End Classi found when i send the updateSettings from a Windows Forms program the response comes back Complete, but when i use the getSettings method the response is always 9600 no matter what i change it to with the updateSettings method.
Does the DLL not retain the settings for the serialPort1???
Also i have to record audio from multiple sources and wondered if i could create a DLL to record audio to hard drive and then run multiple instances of it depending on the number of microphones fitted???
Any help would be much appreciated
Regards
Stu
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
		
	
	
	
		
			
		
		
	
								
							
							 
	 
 
		 , i changed the code to your example but changed the following so i could see what was happening, The updateSettings i changed the return to an integer and returned the Baudrate to see if it actually did change.  and the baudrate returned was 4800 (this is what i sent), but then if i use the getSettings directly after the DLL returns 9600 again. So it seems the DLL doesn't hold on the the values set???
, i changed the code to your example but changed the following so i could see what was happening, The updateSettings i changed the return to an integer and returned the Baudrate to see if it actually did change.  and the baudrate returned was 4800 (this is what i sent), but then if i use the getSettings directly after the DLL returns 9600 again. So it seems the DLL doesn't hold on the the values set??? 
 
		 
 
		