|
|
johnjsm wrote: myProcess.WaitForExit() ' Wait until it completes before moving on
prgOutput = myProcess.StandardOutput.ReadToEnd ' Get the DOS output
Try changing the order of these two lines
Cheers,
Suresh
|
|
|
|
|
I did what you suggested and it works. Thnaks for your help.
|
|
|
|
|
Just got VB 2005 and wonder, How do you add code snippets to the list.
Also can anyone recommend any web sites for code snippets?
Thanks
|
|
|
|
|
directred wrote: Also can anyone recommend any web sites for code snippets
All you have to do is type "vb.net 2005 code snippets" into Google.
directred wrote: Just got VB 2005 and wonder, How do you add code snippets to the list.
Have you tried typing "code snippets" into the Index tab "Look for" box in the MSDN Library installed with Visual Studio? There's tons of information on it. Index entries include "creating", "creating for XML files", "customizing", "deleting", "finding", "inserting", "managing", ... Complete with all kinds of "How To's".
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
i have created a program that i can load a text file to my textbox. but i can work it out in image. any idea how to do that?thx
Don't block the drive way of all the newbies in programming. )
|
|
|
|
|
What have you tried ? You can't put an image in a textbox, but you can use Bitmap.FromFile to get a bitmap from the path selected, or FromStream if the dialog offers a stream. A picture box is the easy way to show an image.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
ok thank you. i will try what you said. thanks again
Don't block the drive way of all the newbies in programming.
|
|
|
|
|
i use following code:
--------------------------------------
private sub ShareFolder()
Dim ct As New DirectoryEntry("WinNT://" +
SystemInformation.ComputerName + "/LanmanServer")
ct.AuthenticationType = AuthenticationTypes.Signing Or _
AuthenticationTypes.Sealing Or _
AuthenticationTypes.Secure
ct.Username = Nothing
ct.Password = Nothing
Dim shares As DirectoryEntries = ct.Children
Dim share As DirectoryEntry =
ct.Children.Add("foldersharename", "fileshare")
share.Properties("path").Add("c:\new folder")
share.CommitChanges()
end sub
-------------------------------------
After calling ShareFolder function,"c:\new folder" folder was shared.
But when opening the folder from any other computer than mine through
LAN (Local Area Network), "\\Tulgaa\foldersharename is not accessible. You
might not have permission to user this network resource. Contact the
administrator of this server ot find out if you have access
permissions" msg is thrown. When I share a folder manually from
Explorer, all is fine.
How to solve this problem, tell me please !!!
Tulgaa
-- modified at 2:33 Saturday 21st April, 2007
|
|
|
|
|
If your example code is accurate, then you've shared out the folder "C:\New Folder" with a share name of "foldersharename". You then tried to open the folder from another machine using the wrong name. You have to use the sharename in the UNC path, not the folder name.
\\server\sharename\subfolder\subfolder\file
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
i tried to open the folder from another machine using correct path which was "\\server\foldersharename" .
i'm trying to share a folder by another way. code here: >>
Sub MyShare()<br />
Dim serverName, UserName, AdminName, UserAcct As String<br />
Dim Ace1 As Management.ManagementObject<br />
serverName = SystemInformation.ComputerName<br />
Dim scope As New ManagementScope("\\" + SystemInformation.ComputerName + "\root\cimv2")<br />
Dim wmiShare As New Management.ManagementClass(scope, New Management.ManagementPath("Win32_Share"), Nothing)<br />
UserName = SystemInformation.UserName<br />
<br />
Dim userAccount As ManagementObject<br />
Dim userExists As Boolean = False<br />
Dim userSearcher As New ManagementObjectSearcher(scope, New SelectQuery(String.Format("SELECT * from Win32_UserAccount WHERE domain='{0}'", serverName))) <br />
For Each userAccount In userSearcher.Get()<br />
If (String.Compare(UserName, userAccount("Name"), True) = 0) Then<br />
userExists = True<br />
Exit For<br />
End If<br />
Next<br />
if not userExists then<br />
Msgbox("User not found")<br />
Exit Sub<br />
End if<br />
<br />
Ace1 = SetAce(scope, 2032127, 3, 0, SetTrustee(scope, serverName, UserName, GetBinarySid(scope, userAccount("sid")))) '<br />
<br />
Dim secDescriptor As Management.ManagementObject<br />
secDescriptor = New Management.ManagementClass(scope, New Management.ManagementPath("Win32_SecurityDescriptor"), Nothing).CreateInstance()<br />
secDescriptor("ControlFlags") = 4<br />
secDescriptor("DACL") = New Management.ManagementObject() {Ace1}<br />
<br />
Dim inParams As Management.ManagementBaseObject<br />
inParams = wmiShare.GetMethodParameters("Create")<br />
inParams("Access") = secDescriptor<br />
inParams("Path") = "C:\new folder"<br />
inParams("Name") = "foldersharename"<br />
inParams("Type") = 0<br />
inParams("MaximumAllowed") = 5<br />
inParams("Description") = "FolderDescriptionHere"<br />
Dim outParams As Management.ManagementBaseObject<br />
<br />
outParams = wmiShare.InvokeMethod("Create", inParams, Nothing)<br />
MsgBox("Successful")<br />
End Sub<br />
<br />
Function GetBinarySid(ByVal scope As ManagementScope, ByVal sid As String)As Byte() <br />
Dim wmiSid As New ManagementObject(scope, New ManagementPath(String.Format("Win32_SID.SID='{0}'", sid)), Nothing)<br />
Return wmiSid("BinaryRepresentation")<br />
End Function<br />
<br />
Function SetTrustee(ByVal scope As Management.ManagementScope, ByVal domain As String, ByVal name As String, ByVal UserSid As Byte()) As Management.ManagementObject<br />
Dim wmiTrustee As Management.ManagementObject<br />
wmiTrustee = New Management.ManagementClass(scope, New Management.ManagementPath("Win32_Trustee"), Nothing).CreateInstance()<br />
wmiTrustee("Domain") = domain<br />
wmiTrustee("Name") = name<br />
wmiTrustee("SID") = UserSid<br />
Return wmiTrustee<br />
End Function<br />
<br />
Function SetAce(ByVal scope As Management.ManagementScope, ByVal accessMask As Integer, ByVal aceFlags As Integer, ByVal aceType As Integer, ByVal wmiTrustee As Management.ManagementObject) As Management.ManagementObject<br />
Dim wmiAce As Management.ManagementObject<br />
wmiAce = New Management.ManagementClass(scope, New Management.ManagementPath("Win32_ACE"), Nothing).CreateInstance()<br />
wmiAce("AccessMask") = accessMask<br />
wmiAce("AceFlags") = aceFlags<br />
wmiAce("AceType") = aceType<br />
wmiAce("Trustee") = wmiTrustee<br />
Return wmiAce<br />
End Function
But steel that message appeared. When I tried to open the folder from Windows Explorer from other machines, message appears again. My user is of Administrator group and has no password. When I share a folder manually from Explorer, all is fine. What is wrong with me?
|
|
|
|
|
battulga wrote: My user is of Administrator group and has no password.
Windows file sharing hates blank passwords. Try setting yourself a password and try it again.
|
|
|
|
|
I have 3 images of different sizes and i want to display all of them in a loop.
how can i resize the images to picture box's size.
|
|
|
|
|
A picture box can be set to do this for you automatically.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Picture box will resize itself to the size of picture.
But i want to resize the picture according to the size of picture box.
|
|
|
|
|
No, a picture box does not resize itself, it stretches the image to fit itself.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Actually it does both. It all depends on the sizemode that's been selected.
|
|
|
|
|
OK, I knew there were different modes, I had no idea one of those actually resizes the picturebox. But then, I'd never use a picture box in my code.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hey everyone, just got an assignment to create an app to take a complex equation (i.e. 20+4/2-6*3) and compute it. I know that you need to take the expression and put it into postfix notation, but how do get to that point and how do I calculate it. I don't usually ask, but we just got the assignment this week and I leave for another class in Chicago over the weekend, so I will be pressed to get it done before Tuesday.
Any ideas to help me on my way?
|
|
|
|
|
Perhaps check for occurences of the functional characters and return substrings between them, then calculate in the correct order via BDMAS (Brackets, Division, Multiplication, Addition, Subtraction). The actual code i don't know for sure but i'll have a go at it for you.
Posted by The ANZAC
|
|
|
|
|
This is a truly complex project. One beyond my skill. As far as i can work out, you need to split the string at the specific locations, take note of the function at that point, split the equation either side of it, then priorise the calculations according to the order of operations. Sounds simple, the code is more difficult. I hope this has helped.
Posted by The ANZAC
|
|
|
|
|
Yeah, I've got it set up now to split the original equation (which is in string format) on the condition on whether of not you have a number or an operator. The operator goes to a stack while the numbers go to an array list. The operators only get popped out of the stack based on the conditions of solving a complex equation, but the problem I am having is when I check the next item in the string to make sure that it isn't another part of the number.
|
|
|
|
|
Okay, I figured out how to get the postfix order. Yesterday I remembered that in a data structures class, we built a c++ program that did the same, but we only used variables and didn't do any equation solving. Luckily, I never sell back my CS school books, and I had seen my old data structures book in our storage just last Sunday, so I pulled it out and got the program half way finished. So all I have left is to do the solving.
|
|
|
|
|
I have a Class (Class1) and a Form (Form1)that have a object (cl as Class1)
Whene I added a first new DataRow to a DataTable in cl a Sub (Row_Changed)was called One time
and Whene I added a Second new DataRow to a DataTable in cl a Sub (Row_Changed)was calling two times
I Want a Sub was called One time
------------------------------------------------------------------------------
Public Class Class1
Public Dt As New DataTable
Dim N As Integer
Sub New()
End Sub
Private Sub Row_Changed(ByVal Sender As Object, ByVal e As DataRowChangeEventArgs)
If e.Action = DataRowAction.Add Then
e.Row(1) = N - 1
MsgBox(e.Action.ToString & Str(N) & "," & e.Row(1))
End If
End Sub
Public Sub Start()
AddHandler Dt.RowChanged, AddressOf Row_Changed
End Sub
End Class
--------------------------------------------------------------------------------
Public Class Form1
Dim N As Integer
Dim Cl As New Class1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TestDataSet.Tables(0) has Two Column
Cl.Dt = TestDataSet.Tables(0)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Cl.Start()
Dim Dr As DataRow
N += 1
Dr = Cl.Dt.NewRow
Dr(0) = N
Dr(1) = Str(N)
Cl.Dt.Rows.Add(Dr)
End Sub
End Class
|
|
|
|
|
I only looked breifly, but you could remove the handler after the sub has been called once...Just put
RemoveHandler Dt.RowChanged, AddressOf Row_Changed
right after MsgBox(e.Action.ToString & Str(N) & "," & e.Row(1))
in Private Sub Row_Changed
Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so
|
|
|
|