|
Thank you for your suggestion and I appreciate it, however it did not work.
After some experimentation, I was able to get it to work. I am posting my solution in the event that it will help someone else. There were two things I was doing wrong:
1. I did not provide a redirect for the input. Seems you need to redirect error, input, and output even if you are not using the data.
2. I was using WaitForExit in the wrong context.
Here is the code that works:
info.StartInfo.FileName = ("net.exe")
info.StartInfo.UseShellExecute = False
info.StartInfo.RedirectStandardInput = True
info.StartInfo.RedirectStandardError = True
info.StartInfo.RedirectStandardOutput = True
info.StartInfo.CreateNoWindow = True
info.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
info.StartInfo.Arguments = "use z: \\server\share " & My.Settings.rbsSrvPwd & " /user:" & My.Settings.rbsSrvUsr
Process.Start(info.StartInfo)
If anyone sees any flaws please let me know.
mzak0420
|
|
|
|
|
I'm using VB.NET 2005 Express.
I have been working on a project that on startup populates a ListView with a total of 28 ListItems. Each one has a SmallIcon and LargeIcon (the SmallIcons are taken from 5 different gifs, whereas the LargeIcons are all unique). When I was using just a couple of dummy gifs to test other features, it was fast. Now it takes about 10-15 seconds to load the images into the respective ImageLists. How could it possibly take this long to load images? VB 6 was way faster and gave me the option of designating a different key for small and large icons, now (as far as I know) I have to use the same key for both and thus unnecessarily reload copies of the same image to the SmallIcon ImageList.
I've tried all sorts of things like BeginUpdate/EndUpdate, setting ListView.SortOrder = Nothing, delinking the ImageLists from the ListView and then relinking them, etc. to no avail. Why did they make such an easy control in VB 6 so much harder to use? Sorry if this problem has been dealt with here already.
Please help!
ccliam
|
|
|
|
|
Seriously, does anyone know a quick way to add images to an image list at runtime? Both Bitmap.FromFile() and Image.FromFile() seem to be equally slow, as is New Bitmap(). The gifs I'm adding are not large so I don't get what is taking so long.
Here's the specific code that's running so slow (it gets called within a For/Next loop):
iml16.Images.Add(Image.FromFile(strSmallFilename))
iml140.Images.Add(Image.FromFile(strLargeFilename))
I've hear AddRange is faster but I won't ever know how many images there will be to load so I don't see how I could create the array.
ccliam
-- modified at 11:40 Friday 21st July, 2006
|
|
|
|
|
What code do i need to copy a selected item from a list box to clipboard
so then i could paste it into any other program that accepts text
|
|
|
|
|
Clipboard.SetDataObject(....)
|
|
|
|
|
Hey does anyone know how to send a fax using vb.net? Or maybe a third party tool that I could use to send a fax? Any help at all would be much apreciated. Thanks in advance guys(and girls also )
Pablo
www.aes4you.com
|
|
|
|
|
I have some old VB6 code that uses the Kodak Image Edit and Image Admin controls to manipulate TIFF documents; to send the fax, I used Exchange, CDO and said the address as FAX:888-888-88888 (or whatever the number is).
Have not recreated it in VB.NET, but, that may be coming...
Hope that helps...
Tim
|
|
|
|
|
Would you mind sending me the source?
Pablo
www.aes4you.com
|
|
|
|
|
I made a project that uses Language "Urdu". I want to know that how i check that Urdu is installed on the Target System.
Shahzad Munir.
|
|
|
|
|
I want to know how you add an extra button to the forms title bar. Say, for example, a minimize to tray button next to the minimize button.
Posted by The ANZAC
|
|
|
|
|
is it possible to compare date in vb???
i want to compare let said if over specific date 1/1/2005 is pass from today date then some event happen....
thanks.
|
|
|
|
|
Dim earlydate As Date, laterdate As Date, today As Date
earlydate = "1/1/2000"
latedate = "1/1/2050"
today = Now
If DateDiff("s", earlydate, today) > 0 Then
MsgBox earlydate & " comes before " & today
Else
MsgBox earlydate & " comes after " & today
End If
1fm1fu
|
|
|
|
|
Hi guys,
I am unable to reset the checked status of a Node in a treeview in vb6. I need to make some nodes readonly i.e. stop the user from changing the Node.Checked status.
Anyone knows how to do it please help.
E.g. this code does not work
Private Sub TreeView1_NodeCheck(ByVal Node As MSComctlLib.Node)
Node.Checked = False ''DOES NOT WORK ;(
''Node.Checked = Not Node.Checked ''DOES NOT WORK ;(
End Sub
1fm1fu
|
|
|
|
|
i have search around the website i just cant open the .dbf in vb, i want to insert in it using vb. anyone have any idea???
|
|
|
|
|
depending on what is in the file, you could probably just read it in using the StreamReader:
VB.NET :
Dim sFilePath as string = "C:\File.DBF"<br />
Dim sContent as string = nothing<br />
<br />
Dim Reader as new StreamReader(sFilePath)<br />
<br />
sContent = Reader.ReadToEnd()
assides that, some more info would help.
http://www.stormbase.net
|
|
|
|
|
I have found problem with send email.
Dim sendmail as smtpClient
Dim sendto as new MailAddress("webmaster@khmerfriend.com")
Dim from As New MailAddress("cheatasp@yahoo.com")
DIm sms As New MailMessage(sendto, from)
sendemail = new smtpClient("localhost")
sendmail.send(sms)
If anyone know please help me
THanks
................
|
|
|
|
|
You're very vague, explain in full grammared sentences, exactly what you are trying to do.
Posted by The ANZAC
|
|
|
|
|
I have used my code that i wrote in this forum, I want to sedn mail using vb.net 2005, but when i try it does not work.
................
|
|
|
|
|
have you seen these links:
http://www.jscape.com/articles/sending_email_using_vb.html\
http://www.codeproject.com/vb/net/epsendmail.asp
Posted by The ANZAC
|
|
|
|
|
Hi to all,
i m working on a project in vb.net with sql server 2000. when i install this software at client-site my connection string does not work( i m sure abt it ). i have taken datasourse as (local). and i install the sql server at client-site as local . Please help me how i can get rid of this problem .
karan
|
|
|
|
|
Could you show us the connection string?
Data Source=(local);Initial Catalog=YourCatalog;User ID=TheUser;Password=thePassword
I have had cases where I had to add 'Trusted_Connection = True' to my connection string. Most people would say that you shouldnt do that on a release though.
Pablo
www.aes4you.com
-- modified at 11:45 Thursday 20th July, 2006
P.S. You may want to try posting in the SQL section for a better answer.
|
|
|
|
|
Thanx for this reply,
I have the same connection string but its not working . i m in big trouble now coz i have already crossed the deadline , pls help me.
|
|
|
|
|
This should help you. Just pass your connection string to new. I have been working on this for a while now. If I am missing any references let me know. I think I made this one pretty much standalone. If you give me your email i will send you this entire component in source code and the dll.
#Region " Imports "
Imports System
Imports System.Data.SqlClient
#End Region
Public Class winConnectionManager
#Region " Variables "
Private m_Conn As SqlConnection
Private m_ConnStr As String
Private m_Valid As Boolean = True
Protected Shared m_ShowErrors As Boolean
#End Region
#Region " Constructor "
Public Sub New(Optional ByVal showErrors As Boolean = True)
Me.New(winAppConfig.GetSetting("SQLString"), showErrors)
End Sub
Public Sub New(ByVal conStr As String, Optional ByVal showErrors As Boolean = True)
Try
m_ShowErrors = showErrors
m_ConnStr = conStr
m_Conn = New SqlConnection(m_ConnStr)
m_Conn.Open()
Catch ex As Exception
m_Valid = False
If m_ShowErrors Then
Throw New Exception(ex.Message & vbCrLf & vbCrLf & " Occured in winConnectionManager::New")
End If
End Try
End Sub
#End Region
#Region " Propertys "
Public ReadOnly Property GetConnection() As SqlConnection
Get
Return m_Conn
End Get
End Property
Public ReadOnly Property GetConnectionString() As String
Get
Return m_ConnStr
End Get
End Property
Public ReadOnly Property Valid() As Boolean
Get
Return m_Valid
End Get
End Property
#End Region
#Region " Public Functions "
Public Function UpdateDataSet(ByVal ds As DataSet, Optional ByVal allowDelete As Boolean = True) As Boolean
Try
If Not m_Valid Then Return False
If Not winDSUtils.IsDSEmpty(ds) Then
If ds.HasChanges Then
Dim tbl As String = ds.Tables(0).TableName
Dim pkField As String = ds.Tables(0).PrimaryKey(0).ColumnName
Dim theInsert As String = Nothing
Dim tryedToDelete As Boolean = False
For Each r As DataRow In ds.GetChanges.Tables(0).Rows
Dim state As DataRowState = r.RowState
Select Case state
Case DataRowState.Added
If theInsert Is Nothing Then theInsert = winSQLUtils.BuildInsertSQL(ds.Tables(0))
r.AcceptChanges()
ExecuteNonQry(theInsert & winSQLUtils.GetInsertValues(r))
Case DataRowState.Deleted
r.RejectChanges()
If allowDelete Then
ExecuteNonQry("Delete From " & tbl & " Where " & pkField & " = " & r.Item(pkField))
r.Delete()
Else : tryedToDelete = True
End If
Case DataRowState.Modified
r.AcceptChanges()
ExecuteNonQry(winSQLUtils.GetUpdateSQL(r))
End Select
Next r
If tryedToDelete Then MsgBox("You are not alowed to delete these items!")
ds.AcceptChanges()
End If
End If
Catch ex As Exception
If m_ShowErrors Then
Throw New Exception(ex.Message & vbCrLf & vbCrLf & " Occured in winConnectionManager::UpdateDataSet")
End If
Return False
End Try
End Function
Public Function InsertDataRowReturnKey(ByVal r As DataRow) As Integer
Try
ExecuteNonQry(winSQLUtils.GetInsertSQL(r))
Return GetLastKey(r.Table.TableName)
Catch ex As Exception
If m_ShowErrors Then
Throw New Exception(ex.Message & vbCrLf & vbCrLf & " Occured in winConnectionManager::InsertDataRowReturnKey")
End If
Return -1
End Try
End Function
Public Function GetLastKey(ByVal tblName As String) As Integer
Try
Return IIf(m_Valid, CInt(ExecuteScaler("SELECT IDENT_CURRENT('" & tblName & "') As ID")), -1)
Catch ex As Exception
If m_ShowErrors Then
Throw New Exception(ex.Message & vbCrLf & vbCrLf & " Occured in winConnectionManager::GetLastKey")
End If
Return -1
End Try
End Function
Public Function ExecuteScaler(ByVal sqlStr As String) As Object
Try
If Not m_Valid Then Return Nothing
Return New SqlCommand(sqlStr, m_Conn).ExecuteScalar()
Catch ex As Exception
If m_ShowErrors Then
Throw New Exception(ex.Message & vbCrLf & vbCrLf & " Occured in winConnectionManager::ExecuteScaler")
End If
Return Nothing
End Try
End Function
Public Function Execute(ByVal sqlStr As String) As DataSet
Try
If Not m_Valid Then Return Nothing
Dim ds As New DataSet
With New SqlDataAdapter(New SqlCommand(sqlStr, m_Conn))
.Fill(ds)
End With
Return ds
Catch ex As Exception
If m_ShowErrors Then
Throw New Exception(ex.Message & vbCrLf & vbCrLf & " Occured in winConnectionManager::Execute")
End If
Return Nothing
End Try
End Function
Public Function ExecuteNonQry(ByVal sqlStr As String) As Integer
Try
IIf(m_Valid, New SqlCommand(sqlStr, m_Conn).ExecuteNonQuery, 0)
Catch ex As Exception
If m_ShowErrors Then
Throw New Exception(ex.Message & vbCrLf & vbCrLf & " Occured in winConnectionManager::ExecuteNonQuery")
End If
Return 0
End Try
End Function
Public Function GetData(ByVal sqlStr As String, ByVal tblName As String) As DataSet
Try
If Not m_Valid Then Return Nothing
Dim ds As New DataSet
With New SqlDataAdapter(New SqlCommand(sqlStr, m_Conn))
.Fill(ds, tblName)
End With
Return ds
Catch ex As Exception
If m_ShowErrors Then
Throw New Exception(ex.Message & vbCrLf & vbCrLf & " Occured in winConnectionManager::GetData")
End If
Return Nothing
End Try
End Function
#Region " DataReader "
Public Function GetDataReader(ByVal sqlStr As String) As SqlDataReader
Try
If Not m_Valid Then Return Nothing
Return New SqlCommand(sqlStr, m_Conn).ExecuteReader
Catch ex As Exception
If m_ShowErrors Then
Throw New Exception(ex.Message & vbCrLf & vbCrLf & " Occured in winConnectionManager::GetDataReader")
End If
Return Nothing
End Try
End Function
Public Function RDR_Execute(ByVal sqlStr As String) As DataSet
Try
If Not m_Valid Then Return Nothing
Return winDataReaderUtils.DataReaderToDataset(GetDataReader(sqlStr))
Catch ex As Exception
If m_ShowErrors Then
Throw New Exception(ex.Message & vbCrLf & vbCrLf & " Occured in winConnectionManager::ExecuteDR")
End If
Return Nothing
End Try
End Function
Public Function RDR_GetData(ByVal sqlStr As String, ByVal tblName As String) As DataSet
Try
If Not m_Valid Then Return Nothing
Return winDataReaderUtils.DataReaderToDataset(GetDataReader(sqlStr), tblName, tblName)
Catch ex As Exception
If m_ShowErrors Then
Throw New Exception(ex.Message & vbCrLf & vbCrLf & " Occured in winConnectionManager::GetData")
End If
Return Nothing
End Try
End Function
#End Region
#End Region
#Region " Overrides "
Protected Overrides Sub Finalize()
Try
m_Conn.Close()
Catch
End Try
m_Conn = Nothing
MyBase.Finalize()
End Sub
#End Region
End Class
Pablo
www.aes4you.com
|
|
|
|
|
Thanx for this soon reply.
I am using a class file for connection string & other data access functions.
Now i am in a strange problem.Let me explain in detail ,When i have installed the setup on computers in my office, it is functioning properly but when i tried it at client side i have got an error message like this
"The specified module could not be found " .
My connection string is : " Datasource = (local); initial catalog = " My Database" ; userid = sa; "
& the sqlserver is installed as local at the client site.
The configuration of SQL SERVER in my office & client site are same.
Please help me.
|
|
|
|
|
karansharma wrote: "The specified module could not be found "
It doesn't sound to me like the problem is your connection string. It sounds like you have something installed on your computer that your customer does not. I would recoment looking at your clients installed programs and making sure that they have what is nessessary to run your software. Are you using and special components etc? The only thing i can see with your connection string that could be a problem is that 'Datasource' should be 'data source' and 'userid' should be 'user id'.
Pablo
www.aes4you.com
|
|
|
|