|
Yes, you can run a batch script using the Process class.
|
|
|
|
|
Open a command window. Type "Path".
Those are the folders that Windows searches if you do not specify a location. If it ain't in there, it won't be found, unless you specify a full path.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have a CommonDialog that uploads a picture (jpeg) and then saves it to a specific file. It works fine in Windows XP, but not in Windows 7. I have it open in My Computer and then save to a remote temp file. The prblem is that Windows 7 gives you the last location you either viewed or saved to and not the folder that you hard coded into the VB6 program. Is there a way around this? Is there a way to turn the option off in Windows 7 or a different Dialog to use in VB6?
Here's my Code:
Public Sub subUploadImage()
Dim stFromFile As String
Dim stToFile As String
Dim inCnt As Integer
st_MYCOMPUTER_CLSID = "::" & "{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
stPath_Ols_Photo_Temp = "i:\programs\old\photo_temp\"
On Error GoTo ErrorHandler
frmSubjectMaint.CommonDialog1.InitDir = st_MYCOMPUTER_CLSID
If frmSubjectMaint.CommonDialog1.Flags = cdlCancel Then
Exit Sub
End If
frmSubjectMaint.CommonDialog1.Filter = "JPEG Files (*.jpg)|*.jpg"
frmSubjectMaint.CommonDialog1.FileName = ""
frmSubjectMaint.CommonDialog1.Flags = cdlOFNHideReadOnly + cdlOFNOverwritePrompt
frmSubjectMaint.CommonDialog1.ShowOpen
stFromFile = frmSubjectMaint.CommonDialog1.FileName
frmSubjectMaint.CommonDialog1.InitDir = stPath_Ols_Photo_Temp
' frmSubjectMaint.CommonDialog1.InitDir = stPath_Ols_Photo
frmSubjectMaint.CommonDialog1.Filter = "JPEG Files (*.jpg)|*.jpg"
frmSubjectMaint.CommonDialog1.FileName = mskSsn.Text
stToFile = frmSubjectMaint.CommonDialog1.FileName & ".jpg"
frmSubjectMaint.CommonDialog1.ShowSave
FileCopy stFromFile, stPath_Ols_Photo_Temp & stToFile
' FileCopy stFromFile, stPath_Ols_Photo & stToFile
If Dir(stPath_Ols_Photo_Temp & stToFile) <> "" Then
If Dir(stPath_Ols_Photo & stToFile) = "" Then
FileCopy stPath_Ols_Photo_Temp & stToFile, stPath_Ols_Photo & stToFile
Else
inCnt = 1
If Dir(stPath_Ols_Photo & stToFile & ".old" & inCnt) = "" Then
Name stPath_Ols_Photo & stToFile As stPath_Ols_Photo & stToFile & ".old" & inCnt
Else
Do While Dir(stPath_Ols_Photo & stToFile & ".old" & inCnt) <> ""
inCnt = inCnt + 1
Loop
Name stPath_Ols_Photo & stToFile As stPath_Ols_Photo & stToFile & ".old" & inCnt
End If
FileCopy stPath_Ols_Photo_Temp & stToFile, stPath_Ols_Photo & stToFile
End If
Kill stPath_Ols_Photo_Temp & stToFile
End If
frmSubjectMaint.lblNoPhoto.Caption = ""
frmSubjectMaint.imgPhoto.Picture = LoadPicture(stPath_Ols_Photo & stToFile)
Exit Sub
ErrorHandler:
Select Case Err.Number
Case 52
Call subErrorRoutine("There is no disk in the specified drive. Do you want to upload from a floppy diskette?.", 4)
If inUserResponse = vbYes Then
Resume
Else
frmSubjectMaint.CommonDialog1.InitDir = st_MYCOMPUTER_CLSID
Resume Next
End If
Case 58
'Already on file
Resume Next
End Select
End Sub
|
|
|
|
|
You could use the VB.NET OpenFileDialog; there was a toolpack aimed at those who have to migrate from VB6 to VB.NET, that also showed how to call .NET code from VB6.
Alternatively, you could build one from scratch.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
We aren't using VB.NET for this. Otherwise we would just convert the entire program to VB.NET. How would you suggest I "build one from scratch".
|
|
|
|
|
Liefie2000 wrote: We aren't using VB.NET for this I know; the suggestion would be to extend your application using some other language than VB6.
Liefie2000 wrote: How would you suggest I "build one from scratch". The same way any form is built in VB6. That's what the dialog is, just another form with textboxes and buttons.
You're welcome btw
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
When an row in a ListBox is selected, it is highlighted a nice deep blue.
If that ListBox loses focus, the ListBox's selected row remains highlighted in blue.
However, when a ListView loses focus (and it's HideSelection property is set to false), although the selected rows remain highlighted, the highlight is no longer a nice deep blue but rather a barely visible light grey.
Is there a way to change the highlighted color of ListView's selected row when the ListView no longer has focus?
Thanks,
Jim Dolson
|
|
|
|
|
The control is using the system colors to paint itself.
If you want to change the colors it's using, you'll have to paint the control yourself. C# Custom Paint ListView[^]
|
|
|
|
|
In addition to Dave's answer, it's usually not worth the effort. Unless you use the highlight-color as defined in the system-colors, your blue would default to red on my desktop
If it's merely to get consistency then do consider the fact that you are adding code that might throw exceptions/have bugs, while the only advantage is color-consistency (one that is still a non-default, and hence, unexpected)
If you are letting the user make a selection, then you could consider using checkboxes to indicate the selection.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thank you gentlemen. I've decided to leave the default behavior alone.
Jim
|
|
|
|
|
Hello !
I'm using Vb.net 2013 , Entity Framework , SQL Server 2008R2 and SMO.
I want to disconnect from database and set offline.
I try this code using SMO:
conn = New ServerConnection()
conn.ServerInstance = serverName
srv = New Server(conn)
Dim db As Database
db = srv.Databases(databaseName)
db.setoffline
But the problem is that the application hang on the last line and doesn't respond.
Is there anything that I should do with entity framework before set the database offline ?
Thank you !
|
|
|
|
|
You can't use EF to offline a database. You have to use the normal SqlCommand and SqlConnection objects to execute the query yourself.
|
|
|
|
|
Hi Everyone,
I have used below code do open word document from a VB Application with OLEWord control, While opening it below error message is displayed.
"Open Database Connectivity Error" and details below description displayed.
"ODBC Error: [[Microsoft][ODBC Driver Manager] Data Source name not found and no default driver specified
SQL State: IM002
Return Code: SQL_ERROR"
Note:
1. Error occurs randomly.
2. after clicking OK to the Error Message word opening properly.
Code and Images attached.
Kindly help me regarding this issue.
Code:
Dim mWordDoc As Word.Document
Set Data.Recordset = Rx_db.OpenRecordset("SELECT reg_object FROM REGISTER WHERE reg_id = " & vRegId)
If Not Data.Recordset.EOF Then
Data.UpdateControls
If OLEWord.OLEType = vbOLEEmbedded Then
Set mWordDoc = OLEWord.object
If Left(UCase(OLEWord.Class), 13) = "WORD.DOCUMENT" Then
Set mWordDoc = New Word.Document
OLEWord.DoVerb vbOLEOpen
End If
End If
End If
Data.Recordset.Close
|
|
|
|
|
Check your connection-string; it's not related to Word, it's related to the query.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks for your reply.
My connection string like below
"ODBC;DSN=SampleDSN;;UID=SampleId;PWD=sample;"
The error says default driver missing where can we set default driver for specified ODBC connection
|
|
|
|
|
I am trying to mirror a VB frame to RightToLeft direction. I succeeded to mirror the frame, but all the text of frame components(Labels and text box) are mirrored too.
Is there any way to prevent the components to be mirror?
Const WS_EX_LAYOUTRTL = &H400000
Const WS_EX_NOINHERITLAYOUT = &H100000
Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
Get
Dim CP As System.Windows.Forms.CreateParams = MyBase.CreateParams
If Not MyBase.DesignMode() Then
CP.ExStyle = CP.ExStyle Or WS_EX_LAYOUTRTL
End If
Return CP
End Get
End Property
When I tried to add "OR WS_EX_NOINHERITLAYOUT " the frame didn't mirror at all.
|
|
|
|
|
Hi Everyone,
I created a usercontrol and don't know how to put it in Datagridview cell. I already tried to find many solutions here but i totally failed to do that.
I did tried to populate my usercontrols to 3000 times and my form crashed.
Is there any way to place it in datagridview and populate it?
My control looks like this
-----------------------------------------------
[ photo ] Miller Nguyen [button][button]
[ ..... ] VB.NET, SQL, HTML, ASP
[ ..... ] He needs help
[ ..... ] He needs work
-----------------------------------------------
Or anyway to customize a cell like this?
======================
Miller Nguyen
VB.NET, SQL, HTML, ASP
He needs help
He needs work
======================
Thanks a lot.
|
|
|
|
|
Nguyen Ngoc Cuong wrote: tried to populate my usercontrols to 3000 times and my form crashed Error Message? OutOfMemory?
By the way, do you think it is a good UI design to show 3000 items on a single form?
|
|
|
|
|
Yes, it said out of memory
Actually, it will have 700 rows and each row has 4 columns.
Each cell will contain one UserControl
So, I need to have maximum 2800 controls to be loaded
However, I can unload some empty cell to make it lesser
|
|
|
|
|
What do you mean Usercontrol?.
I have populated a access Database to a Datagridview.|
My Skype:nguyentuananh921
If you need contact me.
|
|
|
|
|
It's not only text, it's a control that contain a picture box, 4 labels with nicely format.
|
|
|
|
|
Hi All.
I am new here.I have a Visual Basic 2010 project.In this project I connect to Access 2007 DB File.Everything Is OK.Now I Want to publish this project.It is not ok and I have error message that "Unhandled Exception has occurred in your Applicaiton......"
I know application can't connect to access file but I don't know how to solve.
Please help me.
Thanks
|
|
|
|
|
Nguyen Tuan Anh wrote: Unhandled Exception has occurred in your Applicaiton This tells you that something fatal happened, and your application has not been written to trap and report the error properly. Exceptions should be caught in Try ... Catch blocks, and information reported to the user about what is happening, and where. If you don't know where the error occurred then you will need to run your application in the debugger to find out. Once you have done that you should be able to discover why the error occurred. See http://msdn.microsoft.com/en-GB/library/fk6t46tz.aspx[^] for more information.
|
|
|
|
|
Everything is OK before I Publish.After publish I Think Application can't connect to DB because it is not include in the setup file or .....that i don't know.
|
|
|
|