|
paritosha wrote: my machine doesnot have MSDN.
But the internet does!
http://msdn.microsoft.com
|
|
|
|
|
I hope i will be usefull
it is a my old program
http://www.fulminegiallo.it/AnoniMail.zip
|
|
|
|
|
http://lab.msdn.microsoft.com/searchbeta/Default.aspx?query=MAPI+Control
Mahbub8957
|
|
|
|
|
|
I am very new to VB.Net programming.
I am uploading data from one branch office to another
through modem connections of telephone line.
As i am using the MSComm Control And Also NetCommOcx
ActiveX Controls,but as when it is comming to
any one of the properties of the either control,
it is throwing an exception as
An unhandled exception of type 'InvalidActiveXStateException' occurred in
axinterop.NetCommOcx.dll
I hav searched at internet but of no use.
since i hav imported System.Runtime.InteropServices
there is no use.
kindly give a sol to the problem.
I am sending the Module where the properties of the control is used
Imports System.Object
Imports NETCommOCX.NETCommClass
Imports IClean.Mdl_MSCommVariables
Imports System.Runtime.InteropServices
Imports System.Windows.Forms.AxHost
Public Class MdlCl_MSComm
Public WithEvents MsComm1 As New AxNETCommOCX.AxNETComm
Public Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
Dim Modem_Present As Boolean
Public Sub init()
Try
MsComm1.RThreshold = 1
MsComm1.SThreshold = 1
MsComm1.InputLen = 0
MsComm1.CommPort = 1
MsComm1.PortOpen = True
Call Clear_Buffer()
MsComm1.set_Output("ATV1Q0" & Chr(13)) 'Send Attention To the Modem.
'MsComm1.Output = "ATDT" & "055782588" & Chr(13) 'AT tells the modem that a command is coming up.DT tells it to dial the upcoming number using Tone dial.
MsComm1.Handshaking = NETCommOCX.HandshakeConstants.comRTS 'Able to connect and send data but not receive data.
MsComm1.set_Settings("9600,N,8,1")
'AddHandler MsComm1.OnComm, AddressOf MsComm1_OnComm
Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
End Try
End Sub
Public Sub Dial()
Try
MsComm1.set_Output("ATDT" & "055782588" & Chr(13)) 'AT tells the modem that a command is coming up.DT tells it to dial the upcoming number using Tone dial.
Sleep(600)
' Ask the user to wait until the phone rings.
'MessageBox.Show("When you hear a busy signal, click OK." & vbCrLf & "When you hear a ringing signal, pick up the receiver and click OK.", vbInformation Or vbOKOnly, "Please Wait")
MessageBox.Show("When you hear a busy signal, click OK.", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
Catch ex As System.Runtime.InteropServices.COMException
MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
End Try
End Sub
Public Sub Clear_Buffer()
MsComm1.OutBufferCount = 0 'Returns the number of characters waiting in the transmit buffer.
MsComm1.InBufferCount = 0 'Returns the number of characters waiting in the receive buffer.
End Sub
Public Sub Phone_Number(ByVal num As Integer)
Try
MsComm1.set_Output(num)
Sleep(800)
Catch ex As Exception
MessageBox.Show(ex.ToString, "Modem Details", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
End Try
End Sub
Public Sub Data_Transmit_Terminate()
MsComm1.RTSEnable = False 'Disable The "Request To Send" Line.
End Sub
Public Sub Data_Recieve_Terminate()
MsComm1.DTREnable = False 'Disable The "Data Terminal Ready" Line.
End Sub
Public Sub Terminate_Connection() 'Connection is Closed.
MsComm1.PortOpen = False
MsComm1.RTSEnable = False
MsComm1.DTREnable = False
End Sub
Public Sub Modem_Connect()
End Sub
Public Sub Send_Data(ByVal dat As String)
MsComm1.set_Output(dat)
Sleep(500)
End Sub
'Returns the most recent communication event or error.
Private Sub MsComm1_OnComm(ByVal sender As Object, ByVal e As System.EventArgs) Handles MsComm1.OnComm
'Modem_Input = MsComm1.Input
Select Case MsComm1.CommEvent
Case NETCommOCX.NETCommConstants.NETComm_EV_SEND
status = "Sending . . . "
Exit Select
Case NETCommOCX.NETCommConstants.NETComm_ER_BREAK
Case NETCommOCX.NETCommConstants.NETComm_EV_RING
status = "Ringing . . . "
Exit Select
Case NETCommOCX.NETCommConstants.NETComm_ER_RXPARITY
Case NETCommOCX.NETCommConstants.NETComm_ER_RXOVER
Case NETCommOCX.NETCommConstants.NETComm_EV_EOF
End Select
'If MsComm1.CommEvent = 6 Then
' status = "Ring . . . "
'ElseIf MsComm1.CommEvent = 1 Then
' status = "Transfer Data . . . "
'End If
'If MsComm1.CommEvent = 1001 Then
' MessageBox.Show("Break Signal Is Recieved.", "Modem Details", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
'ElseIf MsComm1.CommEvent = 1004 Then
' MessageBox.Show("Framing Error.", "Modem Details", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
'ElseIf MsComm1.CommEvent = 1009 Then
' MessageBox.Show("Parity Error.", "Modem Details", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
'ElseIf MsComm1.CommEvent = 1010 Then
' MessageBox.Show("Transmit Buffer Full.", "Modem Details", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
'ElseIf MsComm1.CommEvent = 1011 Then
' MessageBox.Show("Unexpected Error.", "Modem Details", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
'End If
End Sub
End Class
neelima
|
|
|
|
|
Hello everyone,I'm still migrating the VB to VB.NET Engine here.I am a beginner to VB.NET. I found this error message while I'm coding,can anyone give me a help please?
Overload resolution failed because no accessible 'New' can be called without a narrowing conversion: 'Public Sub New(selectCommandText As String, selectConnection As System.Data.SqlClient.SqlConnection)': Argument matching parameter 'selectConnection' narrows from 'System.Object' to 'System.Data.SqlClient.SqlConnection'. 'Public Sub New(selectCommandText As String, selectConnectionString As String)': Argument matching parameter 'selectConnectionString' narrows from 'System.Object' to 'String'.
And the following is my code>>
Private Sub Spam_Now()
Dim MemberDV As DataView
Dim i As Integer
Dim sql1, sql2, sql3 As String
'sql1 = "SELECT TOP 20 * FROM TT_Member WHERE Reminder = '0' AND Status = '1'"
ObAdapter1 = New SqlDataAdapter("SELECT TOP 20 * FROM TT_Mber WHERE Reminder = '0' AND Status = '1'", Obconn1) '<
|
|
|
|
|
drexler_kk wrote: Argument matching parameter 'selectConnectionString' narrows from 'System.Object' to 'String'.
You are passing a String parameter for an SQLConnection object. The argument you are passing must be an SQLConnection object and not String object.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Thanks for your solution. Do you mean that I should change that line to the following?
ObAdapter1 = New SqlDataAdapter(Obconn1, "SELECT TOP 20 * FROM TT_Member WHERE Reminder = '0' AND Status = '1'")
ds1 = New DataSet
ObAdapter1.Fill(ds1, "MemberList")
I have try but it works,so I just want to reconfirm that is what you ask me to modified?
Thank you so much for the solution and effort.
Regards
Drexler
|
|
|
|
|
|
Yeah,thank you so much. I really learn from your advice. Good solution.
Regards
Drexler
|
|
|
|
|
hi,
i try to send an email with attachment, but when the program fails to send out the mail, i can't delete the file (the file i wish to attach in the mail) in my local drive, i think it is locked when i am trying to send, i have used the code below to delete the file
For Each sSubstr In attach_string.Split(delim)<br />
If System.IO.File.Exists(sSubstr) = True Then<br />
Try<br />
System.IO.File.Delete(sSubstr)<br />
'MsgBox("File Deleted")<br />
Catch ex As IOException<br />
Label1.Text = ex.Message<br />
Finally<br />
End Try<br />
End If<br />
Next
i didn't catch any exception while debuging but it fails to delete the file, when i go to the path (where i the file is) to delete the file manually, windows tells me "Canot delete File: Access is Denied. Make sure the file is not ful or write protected or currently in use". Any idea how to fix that?
-- modified at 23:23 Sunday 22nd January, 2006
|
|
|
|
|
|
thanks for your fast reply,
can i know how to close the open handles file, after i fail to attach a mail when executing
SmtpMail.Send(Message)
For example i am trying to do:
try<br />
SmtpMail.Send(Message)<br />
catch ex as exception<br />
' what should i do here to close the open handles file when i fail to attach?<br />
' then i fail to delete the attachment here<br />
finally<br />
end catch
Thanks
|
|
|
|
|
|
i have called the close method for file steam at the other place of my program but it still din work and the System.Web.Mail.SmtpMail does not have a close method,can u show me a simple piece of code on wht to write in the catch block when i fail to send the email?
<br />
try<br />
If attach_string <> "" Then<br />
For Each sSubstr In attach_string.Split(delim)<br />
Dim myAttachment As MailAttachment = New MailAttachment(sSubstr)<br />
Message.Attachments.Add(myAttachment)<br />
Next<br />
End If<br />
<br />
SmtpMail.Send(Message)<br />
catch ex as exception<br />
' what should i do here to close the open handles file when i fail to attach?<br />
finally<br />
end catch
|
|
|
|
|
Try Disposing the SmtpMail object before you try to delete the file. There is no other method to "force" the filehandle to be released.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
can you show me on how to dispose off the smtpmail object? because i couldn't find any dispose method or close there, thanks alot!
|
|
|
|
|
I'm sorry, it should have been the Message object, not the SmtpMail object.
Message.Dispose()
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I guess this one maybe a bit tough, but, does anyone know how to create a virtual com port? Or have any idea on how this can be done?
The aim is to create 2 ports with a virtual connection between them so that I can send data out one port for testing a program that recieves data from the other.
Thanks..
|
|
|
|
|
|
|
I want to access the "Data Link Property Layer" during runtime so that i could create a connection during deployment without editing the connection string value which is saved in a text file (which I usually do).
Anybody has an idea on how will i access Data Link Property and display it during run time?
|
|
|
|
|
thealca wrote: Data Link Property Layer
First of all, what are you calling a "Data Link Property Layer"?? You can't run any of your applications code in the middle of its installation. Any configuration options should be stored in the apps config file. Your installer should ask for different options, install the app, then modify the configuration file(s) of the app.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
"modify the configuration file(s) of the app."
I want this to be done in a GUI which is I thought It would be better if I can access the "Data Link Properties" GUI, from which I can select the Provider and the Data Source and save it to a file (might be .INI file or .XML file), so I don't have to edit the configuration file (app.config) file during deployment, which is also risky if you let somebody do the deployment because he might modify accidentally the other elements.
|
|
|
|
|
Are you talking about a dialog in the Visual Studio designer for setting the properties of a Connection object?
No, you can't get to it during the install. You have to provide some interface for this yourself.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|