|
I have a thread running in the background of Form1 and the thread permanently opens up a new form, Form2, by calling the ShowDialog() method of Form2. On form2 I have a SaveFileDialog but if it tries to open I get this error:
"Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process."
What can I do to resolve this?
|
|
|
|
|
|
How do I best save a datatable to .csv format?
Thanks!
|
|
|
|
|
Depends on what databse you are using.
|
|
|
|
|
How so? I have a datatable in memory that I want to write to .csv. Can I use an adapter, or do I have to enumerate the rows and columns of the table, adding my own commas between each cell and writing the result as a text string?
Thanks!
|
|
|
|
|
cstrader232 wrote: datatable in memory that I want to write to .csv
Check this out http://www.devx.com/vb2themax/Tip/19703[^]
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
All the world's a stage,
And all the men and women merely players.
They have their exits and their entrances;
And one man in his time plays many parts... --William Shakespeare
|
|
|
|
|
|
Very sorry, I mis-read your post, I thought you asked about database not datatable
|
|
|
|
|
|
can someone explain Independentsoft.Webdav.Exchange.Resource.SendMessage component for me i need it in my project
|
|
|
|
|
Ebube wrote: can someone explain Independentsoft.Webdav.Exchange.Resource.SendMessage component for me
This might be far fetched, but perhaps Independentsoft[^] would know something about it?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
how can i make this dummy code in a project run as windowservice
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Me.ProcessMail()
End Sub
#End Region
#Region "NetCredential"
Private Sub InitSenderSession()
Try
'Dim credential As NetworkCredential = New NetworkCredential(UserName, Password, DomainName)
'Dim session As WebdavSession = New WebdavSession(credential)
'resource = New Resource(session)
'Dim mailBox As String = Hostname & "/" &Box & "/"
'Dim SenderMailbox = resource.GetMailbox(mailBox)
' SenderMailbox = resource.GetMailbox("http:///exchange/oe/")"http://s/exchange/m/EmailBox
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
#End Region
#Region "ProcessMail"
Sub ProcessMail()
Try
Dim insert As Boolean
Dim DirObj As New DirectoryInfo(Hostname)
Dim Dirs As DirectoryInfo() = DirObj.GetDirectories("*.*")
Dim DirectoryName As DirectoryInfo
Dim dNfNme As String
For Each DirectoryName In Dirs
Try
Console.WriteLine(DirectoryName.FullName)
Console.WriteLine(DirectoryName.Name)
pfcAccount = DirectoryName.Name
Dim di As String = DirectoryName.FullName & "\IncomingFolder\"
Dim pfaDirs As New DirectoryInfo(DirectoryName.FullName & "\IncomingFolder\")
Dim Files As FileInfo() = pfaDirs.GetFiles("*.*")
Dim Filename As FileInfo
For Each Filename In Files
Try
If (Filename.Attributes And FileAttributes.ReadOnly) Then
Filename.Attributes = (Filename.Attributes And Not FileAttributes.ReadOnly)
End If
Console.WriteLine(Filename.FullName)
Console.WriteLine(Filename.Name)
myfileName = Filename.Name
dNfNme = "/" & DirectoryName.Name & "/IncomingFolder/" & Filename.Name
Dim aTime As Date = Filename.LastAccessTime
' Dim a As Date = Filename.LastAccessTi
If getIncomingFile(Account, myfileName) = False Then
Dim credential As NetworkCredential = New NetworkCredential(diamondUserName, diamondPassword, DomainName)
Dim session As WebdavSession = New WebdavSession(credential)
session.UserMailbox = mailSubject & "/" & diamondEmailBox '"http://myserver/exchange/Administrator/"
Dim resource As Resource = New Resource(session)
"
message1.To = Email1
message1.Bcc = Email2
message1.Cc = Email3
If resource.SendMessage(message1) = True Then
insert = bllclass.InsertIncoming(DirectoryName.Name, myfileName, 0, dNfNme.Trim)
End If
Else
If IsSent = False Then
If getFileStatus(Account, myfileName, dbFullPath) = False Then
Dim credential As NetworkCredential = New NetworkCredential(UserName, Password, DomainName)
Dim session As WebdavSession = New WebdavSession(credential)
session.UserMailbox = mailSubject & "/" & EmailBox '"http://myserver/exchange/Administrator/"
Dim resource As Resource = New Resource(session)
Dim message1 As Message = New Message
If resource.SendMessage(message1) = True Then
End If
Else
insert = bllclass.UpdateIncoming(DirectoryName.Name, myfileName, dNfNme.Trim)
End If
End If
End If
Catch E As Exception
' MsgBox("Error changing attribute for {0}", Filename.FullName)
' MsgBox("Error: {0}", E.Message)
End Try
IsSent = False
Next
Catch E As Exception
'MsgBox("Error accessing {0}", DirectoryName.FullName)
'MsgBox("Error: {0}", E.Message)
End Try
Next
Catch ex As Exception
' MsgBox(ex.Message)
End Try
End Sub
#End Region
End Class
|
|
|
|
|
Start by creating a new project of type Windows Service. Then paste your code in. Then read up on windows services installation and running.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
thanks
pls can you look at that code an tell me how to invoke it if possible with sample code the code is a method inside a project do i need to invoke the entire project
|
|
|
|
|
Ebube wrote: can you look at that code an tell me how to invoke it if possible with sample code
For the right price. Thats what I do for a living
Seriously, if someone else writes your code then you never learn anything. There are plenty of sample windows service applications that you can use for learning.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
i understand can you give a link to the sample application you think can solve my problem
the one i have just write entry to eventlog
|
|
|
|
|
hi all,
how can i use Office 2007 Chart component on a Windows Form ?
however i find some link, but it is related to Office XP
anybody have idea or link that is helpful for me ?
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
To use an Office 2007 feature, you will have to use Visual Studio Tools for Office (VSTO). Another option would be to use Dundas or another charting API.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Hi all
I have one problem.
I have changed debug instead of realese in both options in configuration manager.
now i haven't got configuration manager in Build menu
what i do?
I am new in vb.net
pls help me
Thanks
monika
|
|
|
|
|
In which version do you wok now.
Regards
Anubhava Dimri
anubhava.prodata@gmail.com
9250168195
|
|
|
|
|
hi in your vs IDE select following
Tools-options-Projects and Solutions-General
select the "show advanced build configuration" option at right hand side and click Ok button
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Hello every one..
I have a VB.net application in which i have some common functions in a Module.
Now the issue is...
i call a function (say func_mod()), in the module from a form (say frmMain).
There is a msgbox displayed in func_mod(), on click of "Ok" of the mesgbox instead of going to the next line of the func_mod(), the control gets to frmMain_activate, then to the next line of func_mod.
Is there any way that i can make it sure that the function gets executed first and then the control moves to form activate
Regards
Nishkarsh
|
|
|
|
|
No. As you are using a message box, you are returning control to the windows system, so any event may occur.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi All,
I m using VC++ with backand MSAccess and I m use to store the data by using FileStream AND ODBC.
whether i m getting the data by table and the table is blank then the
record accept the garbaze value.
Pls its needful.
Thanks in Advance
Anubhava Dimri
anubhava.prodata@gmail.com
9250168195
|
|
|
|
|
Member 4542257 wrote: I m using VC++
So that's why you asked in the VB.NET forum? Ask in the C++ forum instead.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|