|
I am fairly (quite) new to .NET programming, trying to do a radio button as a group (only one radio can be selected), documentation indicates I need to add it to a groupBox. In order to have a groupBox, I need the "system.windows.forms" namespace. I try to import it using the following:
<%@ Import Namespace="System.Windows.Forms" %>
Still groupBox is undefined... what am I missing?
Thanks in advance...
|
|
|
|
|
In VB.Net, should the syntax be:
Imports System.Windows.Forms
- It's easier to make than to correct a mistake.
|
|
|
|
|
I tried that,when I do I get the following error...
Namespace or type 'Forms' for the Imports 'System.Windows.Forms' cannot be found.
Thanks for your help
|
|
|
|
|
You cannot add a Windows Forms GroupBox to an ASP.NET form. It simply will not work.
It looks like you read the documentation for the wrong RadioButton. I think you're looking for this[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
HI all,
I'm GRK. I'm getting an unhadled exception in my application.
*** Coming to real problem,I'm calling form two by showdialog() method in the button click event in the first form,and hiding the first form.when closing the second form I'm again enabling the first form. by doing this for more than 3 times I found an exception which is not caught by the try catch block.
Error Message is:
An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll
Additional information: Invalid parameter used.
my code part:
dim obverifier as new frmVerifier
obverifier.ShowDialog()
Me.Refresh()
Me.Visible = False
Need help on this I'm trying to solve this from the whole day and posting it in the group.Any help would be appreciated.
Thanks in advance
GRK
|
|
|
|
|
Are you calling Dispose on the Form object that you called .ShowDialog() on??
Dim obverifier As New frmVerifier
obverifier.ShowDialog()
' Process any last minute info from the form
obverifier.Dispose() '??????????????????
Me.Visible = True
Any form you throw up using .ShowDialog() MUST be disposed when your done with it. Forms shown using the .Show() method do not need to be disposed.
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 8:38 Sunday 18th June, 2006
|
|
|
|
|
Hi Dave,
Thank you very much for solution.I did applied as you said.The application is worked fine for some time and again it is started giving the same error.
I was also using the form close event in the frmVerifier form,for the last minute info from the form.
Now I removed the form close event and copied the last minute info to the dispose method of the frmVerifier.
I couldnt understand what to do I'm trying in every aspect.Please let me know any other solutions. thanks in advance.
-regards
GRK
G Ravi kumar Reddy
Software Engineer
Multywave Technologies
|
|
|
|
|
There's something you're doing in that form, specific to your ap, not in the way forms work, that's causing the problem. I have no idea what your code is doing, so I really can't tell you what's wrong.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
You've either left something behind that still needs to be cleaned up or you're not passing data between forms correctly. If all this second form is doing is verifying SmartCard data against a database, why is it even on a form?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello!
I'm an MS Access veteran making the jump to SQL/VB database apps. I must admit I'm struggling a bit with .Net, I never fancied myself as much of a programmer.
Anywho, my problem is this: How do I emulate the use of subforms with VB.net? In Access, my practice was to use 1 form as a db desktop of sorts, with all nav components on the left, and a subform utilizing the rest of the space. I would change the source of the subform based on the users nav choice.
What is the recommended practice to accomplish this in .net?
|
|
|
|
|
Forms works very differently in Access then they do in VB/C#/C++. There is no such thing as a subform and there is no such thing as changing the datasource of a form.
You have to make the forms up yourself, usually one for each option you want. Then show the appropriate form for your picked option and setup the datasources for the controls on that form.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have the need to use a specific program to display documents, whether they be text, documents, tiff files, whatever. How can I find the installation location of this program and use that to start the process? I cant guarantee that the software will always be installed at C:\Program Files\Program\Program.exe. I know this is done many times with programs because I've installed some myself that look for other installs I just dont know how it is done.
Thanks,
Cleako
|
|
|
|
|
There's no one method that works for every single app. Each app is going to either record this information, most likely in a different place in the Registry, or not record it at all and you'll have to search the hard drive for the .EXE, which is not that common now-a-days.
In the registry, you can try looking under the key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
for the app that you want. You'll need to know it's GUID to find it under here. The GUID will be the same on every machine for each application component version. Under there, you can check for a InstallLocation value which should give you the path that the app was installed to, but not always!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Well why wouldnt I have thought of that? Thanks!
|
|
|
|
|
I would like to know if anyone knows how to access context sensitive help from a help collection from VB. Is it a call to the HTMLHelp API interface or to hh.exe? I have tried to search for help on the web but got nowhere.
I know that I can create an XML help collection file listing all of the CHMs that I want to group into a help file and then include a reference to this .COL file in the hhcolreg.dat file. By creating a shortcut, I am able to open up my linked collection of help files. However, what I really want to do is access the collection from a VB project and open it up directly on a topic of choice in any of the included CHM files.
If anyone knows how to do this then please let me know ASAP.
Laura
|
|
|
|
|
Where do you get the error message?
That error message has nothing to do with the code that you are showing. It comes from a class that have the value, minimum and maximum properties. It sounds like something like a progress bar.
---
b { font-weight: normal; }
|
|
|
|
|
totally true, I have a progress bar.
this is the code I have:
Private Sub Form_Initialize()<br />
InitCommonControls()<br />
End Sub<br />
Private Delegate Function CopyProgressRoutine(ByVal totalFileSize As Int64, ByVal totalBytesTransferred As Int64, ByVal streamSize As Int64, ByVal streamBytesTransferred As Int64, ByVal dwStreamNumber As Int32, ByVal dwCallbackReason As Int32, ByVal hSourceFile As Int32, ByVal hDestinationFile As Int32, ByVal lpData As Int32) As Int32<br />
<br />
Private Declare Auto Function CopyFileEx Lib "kernel32.dll" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal lpProgressRoutine As CopyProgressRoutine, ByVal lpData As Int32, ByVal lpBool As Int32, ByVal dwCopyFlags As Int32) As Int32<br />
Private _totalFileSize As Long = 0<br />
Private _totalBytesCopied As Long = 0<br />
Private _copyProgressRoutine As CopyProgressRoutine<br />
Private Source, Source2, Source3, Source4 As String<br />
Dim UserProfileName = SystemInformation.UserName<br />
<br />
<br />
Private Destination As String = "H:\Documents and Settings\" & UserProfileName<br />
<br />
Dim frmProgBar As New frmProgBar<br />
<br />
<br />
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click<br />
<br />
Me.Close()<br />
Dim fbdBrowse As New FolderBrowserDialog<br />
If fbdBrowse.ShowDialog() = DialogResult.OK Then<br />
<br />
Source = fbdBrowse.SelectedPath<br />
Source2 = Source & "\" & "My Documents"<br />
'Source3 = fbdBrowse.SelectedPath & "\Desktop"<br />
'Source4 = fbdBrowse.SelectedPath & "\Favorites"<br />
Else : End<br />
<br />
End If<br />
<br />
If (MessageBox.Show("You have chosen to copy all files and folders from: " & Chr(13) & Source & Chr(13) & "to: " & Chr(13) & Destination, "Data Mover", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) = DialogResult.OK) Then<br />
<br />
<br />
frmProgBar.Show()<br />
<br />
GetTotalFileSize(New System.IO.DirectoryInfo(Source2))<br />
_copyProgressRoutine = New CopyProgressRoutine(AddressOf CopyProgress)<br />
CopyFiles(New System.IO.DirectoryInfo(Source), Destination)<br />
MessageBox.Show("Data move done, make sure that the user doesn't have custom folders on d:\ or c:\", "Data Mover", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)<br />
<br />
Else<br />
MessageBox.Show("Action Canceled", "Data Mover", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)<br />
<br />
End If<br />
<br />
<br />
End<br />
<br />
End Sub<br />
<br />
Public Function CopyDirectory(ByVal Src As String, ByVal Dest As String, Optional _<br />
ByVal bQuiet As Boolean = False) As Boolean<br />
If Not Directory.Exists(Src) Then<br />
Throw New DirectoryNotFoundException("The directory " & Src & " does not exists")<br />
End If<br />
If Directory.Exists(Dest) AndAlso Not bQuiet Then<br />
If MessageBox.Show("directory " & Dest & " already exists." & vbCrLf & _<br />
"If you continue, any files with the same name will be overwritten", _<br />
"Continue?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, _<br />
MessageBoxDefaultButton.Button2) = DialogResult.Cancel Then Exit Function<br />
End If<br />
<br />
'add Directory Seperator Character (\) for the string concatenation shown later<br />
'If Dest.Substring(Dest.Length - 1, 1) <> Path.DirectorySeparatorChar Then<br />
' Dest += Path.DirectorySeparatorChar<br />
' End If<br />
If Not Directory.Exists(Dest) Then Directory.CreateDirectory(Dest)<br />
Dim Files As String()<br />
Files = Directory.GetFileSystemEntries(Src)<br />
Dim element As String<br />
For Each element In Files<br />
If Directory.Exists(element) Then<br />
'if the current FileSystemEntry is a directory,<br />
'call this function recursively<br />
CopyDirectory(element, Dest & Path.GetFileName(element), True)<br />
Else<br />
'the current FileSystemEntry is a file so just copy it<br />
File.Copy(element, Dest & Path.GetFileName(element), True)<br />
End If<br />
Next<br />
Return True<br />
End Function<br />
Private Function CopyProgress(ByVal totalFileSize As Int64, ByVal totalBytesTransferred As Int64, ByVal streamSize As Int64, ByVal streamBytesTransferred As Int64, ByVal dwStreamNumber As Int32, ByVal dwCallbackReason As Int32, ByVal hSourceFile As Int32, ByVal hDestinationFile As Int32, ByVal lpData As Int32) As Int32<br />
frmProgBar.ProgressBar1.Value = Convert.ToInt32((_totalBytesCopied + totalBytesTransferred) / _totalFileSize * 100)<br />
Application.DoEvents()<br />
End Function<br />
Private Sub GetTotalFileSize(ByVal folder As System.IO.DirectoryInfo)<br />
For Each fi As System.IO.FileInfo In folder.GetFiles<br />
_totalFileSize += fi.Length<br />
Next<br />
For Each di As System.IO.DirectoryInfo In folder.GetDirectories<br />
GetTotalFileSize(di)<br />
Next<br />
End Sub<br />
Private Sub CopyFiles(ByVal folder As System.IO.DirectoryInfo, ByVal destinationFolder As String)<br />
If Not System.IO.Directory.Exists(destinationFolder) Then<br />
System.IO.Directory.CreateDirectory(destinationFolder)<br />
End If<br />
For Each fi As System.IO.FileInfo In folder.GetFiles<br />
CopyFileEx(fi.FullName, destinationFolder & "\" & fi.Name, _copyProgressRoutine, 0, 0, 0)<br />
_totalBytesCopied += fi.Length<br />
Next<br />
For Each di As System.IO.DirectoryInfo In folder.GetDirectories<br />
CopyFiles(di, di.FullName.Replace(Source, Destination))<br />
Next<br />
End Sub<br />
<br />
<br />
End Class
it's the value which is integer I guess and should be converted to something else.
thanks for the quick response btw.
Do you know what I'm doing wrong?
Greetzzz,
CornElvis
www.jackied.nl
-- modified at 9:25 Friday 16th June, 2006
|
|
|
|
|
Could you paste just the relevant code instead of the entire application?
---
b { font-weight: normal; }
|
|
|
|
|
Progressbar1.maximum = 101 (or more)
|
|
|
|
|
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ArgumentOutOfRangeException: Value of '101' is not valid for 'Value'. 'Value' should be between 'minimum' and 'maximum'.
Parameter name: Value
at System.Windows.Forms.ProgressBar.set_Value(Int32 value)
at WindowsApplication1.Form1.Timer1_Tick(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
WindowsApplication1
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Owner/My%20Documents/Downloads/Compressed/hack/Top_Eleven_Hack_v.4.6_64-bit.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 10.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
|
|
|
|
|
Does VB controls support Unicode ? If yes how wothout using Microsoft Forms 2.0.
Jyoti
|
|
|
|
|
I'm assuming you're talking about VB6 or VBA. Yes, all strings in VB6 are BSTR's, which supports Unicode.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I need to ping a system and need check the result (Reply from or Request Time Out)
so i used CreateObject("WScript.Shell")
but this does not run on Win 2000
This is the error i am getting
"System.MissingMemberException: Public member 'Exec' on type 'IWshShell2' not found. at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)"
I need a function which can run on any win OS.
Need help urgently
the function i am using
Dim strComputer As String = IP
Dim objShell = CreateObject("WScript.Shell")
Dim objScriptExec = objShell.Exec("ping -n 2 -w 100 " & strComputer)
Dim strPingResults = LCase(objScriptExec.StdOut.ReadAll)
If InStr(strPingResults, "reply from") Then
else
end if
-- modified at 6:50 Friday 16th June, 2006
|
|
|
|
|
Why are you using Windows Scripting when you can do the exact same thing using the .NET Frameworks Process[^] class?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
objective: to draw a flow chart by drag and drop buttons or anything. but the flow chart must be created only by drag and drop. Does anyone know how to do it..if you have any examples please send them.
KIRAN PINJARLA
|
|
|
|
|