|
If in VB6, right click on the Forms folder, select Add, then choose MDI Form.
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Wow, the Zen of MDI...
Pete
Insert Sig. Here!
|
|
|
|
|
I heard that resource(memory) is freed automatically for you in vb.net but not vb6, so i was wondering how do you do it manually in vb6 ?
|
|
|
|
|
Set MyObject = Nothing
Paul
I think there're pieces of me you've never seen - Tori Amos, Tear in Your Hand
|
|
|
|
|
Setting an Object = Nothing does not ALWAYS free the memory in VB6 (this goes for .NET as well). Get familiar with the Objects you are using, if they implement a "Close" or "Dispose" method, ALWAYS use it before Setting your Object = Nothing.
For example, watch ADO eat up memory in a VB6 app. However, when you use the Close method, the memory usage goes way down. It takes a little while for the VB6 runtime to clean up the memory references, but it happens.
|
|
|
|
|
I am trying to add numbers from a listbox
Its working with vb6 but not with vb.net.
That's what I tried but it's not working
Dim sum As Integer
Dim i As Integer
sum = 0
i = 0
For i = 0 To ListBox2.Items.Count - 1
sum = sum + ListBox2.Items(ListBox2.SelectedIndex)
Next i
TextBox5.Text = sum
I would like the sum of what's inside the listbox to appear inside the textbox
Ex: 12 + 12 + 12 from the listbox and sum would be 36 in the textbox
|
|
|
|
|
I'm thinking you might want to go for
sum = sum + CInt(ListBox2.Items(ListBox2.SelectedIndex).Value)
Paul
Why don't you take a good look at yourself and describe what you see - Led Zeppelin, Misty Mountain Hop
|
|
|
|
|
Please respond to forum
Golfmaltais wrote:
it's still makes a error
sum = sum + CInt(ListBox2.Items(ListBox2.SelectedIndex).Value)
public 'Value' type of 'DataRowView' is no where to be found.
Ooops. My bad.
What happens when you use
For i = 0 To ListBox2.Items.Count - 1
sum = sum + ListBox2.Items(ListBox2.SelectedIndex)
Next i
?
Paul
Why don't you take a good look at yourself and describe what you see - Led Zeppelin, Misty Mountain Hop
|
|
|
|
|
PLEASE respond to forum
Golfmaltais wrote:
not valid with type of 'Integer' and type of 'DataRowView'
Hold on! I've only just clicked on to this DataRowView thing.
How is ListBox2 defined? A ListBox item should be of type Object. A DataRowView is an item of a DataView.
[edit]I have this question wrong. I should be asking "How is ListBox2 populated?"[/edit]
Paul
Why don't you take a good look at yourself and describe what you see - Led Zeppelin, Misty Mountain Hop
|
|
|
|
|
I am trying to add numbers from a listbox to to make a total in a texbox its working with vb6 but not with vb.net that what I did and it's not working
Dim sum As Integer
Dim i As Integer
sum = 0
i = 0
For i = 0 To ListBox2.Items.Count - 1
sum = sum + ListBox2.Items(ListBox2.SelectedIndex)
Next i
TextBox5.Text = sum
|
|
|
|
|
Try specifying the property of the object you are referencing in:
sum = sum + ListBox2.Items(ListBox2.SelectedIndex).
In VB6 each data type had a default property, and I don't think VB.NET has this so you need to indicate which property you are reading from. Is it numeric?
HTH
Andy
|
|
|
|
|
Hi,
I wrote a Collection Class(viz: MYCollection)
(Derived from Collection Base).
And have added methods for Add() and Remove().
I have used this Class in a Custom Control,
and exposed a Property of type MyCollection.
Now, the VS.Net IDE does show the Collection Editor
Dialog Box for the Property,but when I add items to the
collection using the Collection Editor, the changes
are not persisted. (ie: The IDE does not Generate code
for the Items added to the collection).
What is to be done to persist the Items Added using
the Collection Editor (ie: to make the VS.Net generate code for the Added Items, just like it does for ListView
Items Collection, for Example)
Someone please help me....
Thanks
|
|
|
|
|
As I said: I want to read the summary information out of an word file.
I got a definition page of a wordfile (v8.0) at http://www.wotsit.org.
But the offsets described in this file seems to be invalid.
Infos:
SummaryInformation -> STTBFASSOC (Table of Associated Strings)
STTBFASSOC -> offset in FIB: 410 0x019A fcSttbfAssoc long
the FIB starts at offset 0x0000
Maybe somebody had the same problem ... and fixed it? So that he can help me...
thx
Martin
|
|
|
|
|
I set the background picture of my main window. But I just can't get rid of it from the attribute window latter. How can I remove it? Thanks
|
|
|
|
|
I have never found a way to do that. You could do what I have always resorted to. Go into the Windows Forms Designer Generated Code region and remove the Form1.BackgroundPicture property. Then save and exit VS.NET. Reopen the thing and it should be gone.
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
|
|
|
|
|
Go to the property, mark all the text with the mouse and press DELETE.
It's strange, but it's this way...
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
After many hours of battling with others sample code and sifting through countless message board posts I believe I have managed to come up with a fairly functional and stable encryption and decryption class that utilises multiple encryption methods.
The code is shown below and a sample call would look something like
Dim Crypto As New Crypto(Crypto.Providers.DES)
Dim Encrypted as string = Crypto.Encrypt("Test String", "Keystring")
Dim Decrypted as string = Crypto.Decrypt(Encrypted , "Keystring")
‘Crypto class
Imports System.Security.Cryptography
Imports System.IO
Imports System.Text
'SymmCrypto is a wrapper of System.Security.Cryptography.SymmetricAlgorithm classes
'and simplifies the interface. It supports customized SymmetricAlgorithm as well.
'Original Code from Frank Fang
'Revised by Jerome Howard to remove Bad Data errors, create seperate CryptoIV and
'use the maximum legal keysize for each encryption algorithm
Public Class Crypto
'256 Bit IV Key that is truncated when a smaller keys are required
Private bytIV() As Byte = _
{12, 241, 10, 21, 90, 74, 11, 39, 9, 91, 45, 78, 189, 211, 133, 62, 121, 22, 101, 34, 90, 74, 121, 39, 93, 9, 45, 78, 1, 211, 33, 162}
'Supported .Net intrinsic SymmetricAlgorithm classes.
Public Enum Providers
DES
RC2
Rijndael
End Enum
Private _CryptoService As SymmetricAlgorithm
'Constructor for using an intrinsic .Net SymmetricAlgorithm class.
Public Sub New(ByVal NetSelected As Providers)
Select Case NetSelected
Case Providers.DES
_CryptoService = New DESCryptoServiceProvider()
Case Providers.RC2
_CryptoService = New RC2CryptoServiceProvider()
Case Providers.Rijndael
_CryptoService = New RijndaelManaged()
End Select
End Sub
'Constructor for using a customized SymmetricAlgorithm class.
Public Sub New(ByVal ServiceProvider As SymmetricAlgorithm)
_CryptoService = ServiceProvider
End Sub
'Depending on the legal key size limitations of a specific CryptoService provider
'and length of the private key provided, padding the secret key with a character
'or triming it to meet the legal size of the algorithm.
Private Function GetLegalKey(ByVal Key As String) As Byte()
'key sizes are in bits
Dim sTemp As String
If (_CryptoService.LegalKeySizes.Length > 0) Then
Dim maxSize As Integer = _CryptoService.LegalKeySizes(0).MaxSize
If Key.Length * 8 > maxSize Then
sTemp = Key.Substring(0, (maxSize / 8))
ReDim Preserve bytIV((maxSize / 8) - 1)
Else
Dim moreSize As Integer = _CryptoService.LegalKeySizes(0).MinSize
Do While (Key.Length * 8 > moreSize)
moreSize += _CryptoService.LegalKeySizes(0).SkipSize
Loop
ReDim Preserve bytIV(moreSize / 8)
sTemp = Key.PadRight(moreSize / 8, "X")
End If
Else
sTemp = Key
ReDim Preserve bytIV(Key.Length)
End If
'convert the secret key to byte array
Return ASCIIEncoding.ASCII.GetBytes(sTemp)
End Function
Public Function Encrypt(ByVal Source As String, ByVal Key As String) As String
Dim bytIn As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(System.Web.HttpUtility.UrlEncode(Source))
Dim ms As MemoryStream = New MemoryStream()
'set the keys
_CryptoService.Key = GetLegalKey(Key)
_CryptoService.IV = bytIV
'create an Encryptor from the Provider Service instance
Dim encrypto As ICryptoTransform = _CryptoService.CreateEncryptor()
'create Crypto Stream that transforms a stream using the encryption
Dim cs As CryptoStream = New CryptoStream(ms, encrypto, CryptoStreamMode.Write)
'write out encrypted content into MemoryStream
cs.Write(bytIn, 0, bytIn.Length)
cs.FlushFinalBlock()
cs.Close()
Dim bytOut() As Byte = ms.ToArray()
ms.Close()
Return Convert.ToBase64String(bytOut) 'convert into Base64 so that the result can be used in xml
End Function
Public Function Decrypt(ByVal Source As String, ByVal Key As String) As String
'convert from Base64 to binary
Dim bytIn As Byte() = System.Convert.FromBase64String(Source)
Dim ms As MemoryStream = New MemoryStream(bytIn)
Dim bytKey() As Byte = GetLegalKey(Key)
Dim bytTemp(bytIn.Length) As Byte
'set the private key
_CryptoService.Key = bytKey
_CryptoService.IV = bytIV
'create a Decryptor from the Provider Service instance
Dim encrypto As ICryptoTransform = _CryptoService.CreateDecryptor()
'create Crypto Stream that transforms a stream using the decryption
Dim cs As CryptoStream = New CryptoStream(ms, encrypto, CryptoStreamMode.Read)
Try
'read out the result from the Crypto Stream
cs.Read(bytTemp, 0, bytTemp.Length)
cs.FlushFinalBlock()
ms.Close()
cs.Close()
Catch
End Try
Return System.Web.HttpUtility.UrlDecode(Encoding.ASCII.GetString(bytTemp))
End Function
End Class
|
|
|
|
|
Simple question that has me stumped.
Help!
Chris
|
|
|
|
|
Have a look at the article "Registry handling with .NET" by S Nishant in this site (www.codeproject.com/dotnet/csregistry01.asp).
The VB.NET equivalent is virtually identical.
Imports Microsoft.Win32.Registry
Imports Microsoft.Win32.RegistryKey
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rKey As Microsoft.Win32.RegistryKey
Dim rKey1 As Microsoft.Win32.RegistryKey
rKey = Microsoft.Win32.Registry.LocalMachine
rKey1 = rKey.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion")
ListBox1.Items.Add("RegisteredOwner :- " + rKey1.GetValue("RegisteredOwner"))
ListBox1.Items.Add("RegisteredOrganization :- " + rKey1.GetValue("RegisteredOrganization"))
ListBox1.Items.Add("ProductName :- " + rKey1.GetValue("ProductName"))
ListBox1.Items.Add("CSDVersion :- " + rKey1.GetValue("CSDVersion"))
ListBox1.Items.Add("SystemRoot :- " + rKey1.GetValue("SystemRoot"))
rKey1.Close()
End Sub
HTH
Andy
|
|
|
|
|
Heya - I also had a bit of trouble with the registry. I can modify it easy enough but I can't get it to refresh without restarting the computer. Is there some way to force Windows to reload the registry without restarting?
Thanks
Nic R
------------------------------------------
I beat the internet - the end guy is hard.
|
|
|
|
|
|
plz help me with the Input Validation with textbox in VB.NET?
ex : I wanted input masking to be applied on a textbox for that I addedd MaskEdBox Control in Toolbox and tried with that. But still after running the project nothing happens.
plz help me with input validation in textbox with VB.NET
--waiting for a quick reply
|
|
|
|
|
drmzunlimited wrote:
plz help me with input validation in textbox with VB.NET
What part of this are you actually stuck on???
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
How do I display an mpeg or avi file on a form? Thanks for any help.
|
|
|
|
|
If this is for VB6, just use the 'Windows Media Player' ActiveX. To insert it in VB, go to the menu Project->Components, then select the 'Windows Media Player', then OK.
This will add a component that you can put on your form. Then, go through the properties of this component to load your movie.
Hope this helps !
Jerome
|
|
|
|