|
Sorry, I thought my problem was a bad path problem but it turns out to be something else.
Although the information below is correct, the code recognizes the returned
path as a valid path.
Can someone tell me why this code does not return the complete path?
It seems like this 'old code' worked at one time.
Thank You
Const CSIDL_MYMUSIC as integer = 13 ' My Music
Const CSIDL_PERSONAL As Integer = 5 ' My Documents
<DllImport("Shell32", CharSet:=CharSet.Auto, SetLastError:=True)> _
Public Shared Function SHGetFolderPath(ByVal hWnd As IntPtr, ByVal csidl As Integer, _
ByVal handle As IntPtr, ByVal dwFlags As Integer, _
<MarshalAs(UnmanagedType.LPTStr)> ByVal lpBuffer As System.Text.StringBuilder) As Integer
End Function
For CSIDL_MYMUSIC the return value is "C:\users\myname.Home\Music" instead of "...\My Music"
For CSIDL_PERSONAL the return value is "C:\users\myname.Home\Documents" instead of "...\My Documents"
sub MyFunction()
Dim sb As New StringBuilder(200)
Dim sPath as string
SHGetFolderPath(IntPtr.Zero, CSIDL_MYMUSIC, IntPtr.Zero, 0, sb)
sPath = sb.ToString()
end sub
-- modified 28-Sep-18 18:04pm.
|
|
|
|
|
The names "My Documents", "My Music" etc. are shorthand links used by Explorer. If you open a command window and enter the command dir C:\ you will notice that they do not exist. And when you use the SHGetFolderPath function, it will always return the real full path for the relevant item.
|
|
|
|
|
Thank you for the information. Always good to learn something new.
|
|
|
|
|
|
Alright!!, something else new (to me). Thanks for the info.
|
|
|
|
|
Private Sub Combo1_Click()
Dim drs As New ADODB.Recordset
drs.Open "select * from room where roomno=" & CInt(Combo1.Text), con, 3, 2
If (Not drs.EOF Or drs.BOF) Then
Do Until drs.EOF
Me.Text2.Text = drs!price
drs.MoveNext
Loop
End If
End Sub
|
|
|
|
|
And? What is the question?
|
|
|
|
|
"VB6 lingua mortua est."
* You do not select *, just the rows columns you need
* You do not concatenate strings with unchecked user-input
* You do not load an entire recordset and loop, just to get a single attribute
* You do not code in VB6, not even if a Klingon demands it
* You do not have any question with your code-dump, and as such, should not expect much answers
Aw, and if you are going to be using this forum as your PA, at least be so kind to fill in your name.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hello !
I'm writing a program in vb.net 2017 .
I need to have some forms in a specific size , for example 1180 x 700. The program run very well on users that have new monitors.
But the problem is that some users of this program , have old monitors that support up to 1024 x 768.
Do someone have an opinion how can I resolve this situation ?
Thank you !
|
|
|
|
|
I am assuming you are working on Windows Forms. If not, there is nothing that follows which will help.
Is there any specific reason why the form needs to be of that size? You might want to see TableLayoutPanel control to do control layout. In the panel, you can set column and row sizes to auto, fixed or percentage as per needs. Each cell can have only one control in the panel. The controls must have Dock set to Fill . The panel itself will also have Dock set to Fill (covering entire form).
This will ensure controls resize as the screen does.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
You should never do that. It is the user's choice what size the window should be. You just need to ensure that your form is clearly viewable on any screen size.
|
|
|
|
|
But this is my question , how can I do that my form will be clearly viewable on any screen size !!!
|
|
|
|
|
Take a look at the first reply from iw@. Build for the SMALLEST screen size and have the main control (usually a grid) able to resize (dockable, size="auto"). When viewed on a larger screen the main control then expands to use the available space leaving your peripheral controls (header or footer controls) the original size.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Can anyone tell me if c++ is worth learning or is it outdated?
|
|
|
|
|
Definitely not in the Visual Basic forum. Please don't crosspost it just duplicates effort and gets you a bad reputation.
|
|
|
|
|
Hello
I am using VBA from within the Rockwell (SCADA,PLC,...) Factory Talk View SCADA system.
I need to run a external (to the Factory talk view app) internet explorer process with the url (I use directly the IP) of a Bosch IPCamera. The windows security pop up for authentication comes to input user and password.
This is working fine. To do that from the VBA code i do this
Shell("C:\Program Files\Internet Explorer\iexplore.exe" & " http://192.168.50.11/",vbNormalFocus)
But I need to access directly without popup passing the credential from the VBA.
How can thi be done?
Thank you and regards
|
|
|
|
|
I am looking for a copy of vb.net
|
|
|
|
|
|
I tried Google. I couldn't find a download for Visual Basic.net
|
|
|
|
|
You need to look for Visual Studio.
|
|
|
|
|
VB.NET is a language. Not a downloadable component or app.
Visual Studio supports writing code in VB.NET, as well as a bunch of other languages, and it's free from the link I gave you.
|
|
|
|
|
|
|
Thank you for the info.
Jeff
|
|
|
|
|
I have a copy of Visual Basic 2012 if you want it you can pm me. Thanks
|
|
|
|