|
If you have the strings and you want to find the controls, you could build a dictionary that maps names to controls.
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 )
|
|
|
|
|
You've got me there. I haven't a clue how to do a dictionary.
Bruce
Don't forget to brush |||_____
|
|
|
|
|
I have no idea of the VB sytnax, but a dictionary is an associative container, so you'll end up able to do this
Dim c as Control = myDictionary("MycontrolName")
It's something like
Dim dic as Dictionary(String, Control)
It's a generic container.
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 )
|
|
|
|
|
Thanks for that.
The dictionary did sort a few things out and run faster.
It would be better if you didn't have to loop through to find what you need.
Bruce
Don't forget to brush |||_____
|
|
|
|
|
i add control to cells but as default it locate in Top Left and i can't change it's position to center auomaticaly.
-- modified at 16:12 Sunday 15th April, 2007
|
|
|
|
|
I don't think you can have it centered on the TableLayoutPanel.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
How to random and get Data from Dataset
|
|
|
|
|
Two questions or just a bit involved one?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
How to google, and ask clear questions ?
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 )
|
|
|
|
|
|
The best way to do this, is randomise it at the source. The other way to do it, is to randomly remove rows from your data. Where does the data come from ? Can you explain using more than four words ?
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 )
|
|
|
|
|
Hello
I am doing one application about some kind of information and i need to display last 4 files in file menu, I mean when user ckick file so it should display last 4 files name in file menu,So i have no idea where to start
any help
wating for your kind help
|
|
|
|
|
Hi there,
You can create four registry entries to keep the last edited document's name and path, and each time a new document is created you save it to the top registry entry and move the other documents down the line, and so keep track of the last edited documents. Just a sugestion, hope you can make it work.
Regards, Werries
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
Hi
Thanks for your kind rep
But I am new in vb so can you please tell me how to this task I am confuse that where to start
wating for your kind rep
have a nice time
|
|
|
|
|
Hi there,
Here is a simple sample of what I should use to save the last recent documents of my app. Look at the sequins of moving the most recent files into their positions. Hope you can make something out of this.
SaveSetting("AppName", "RecentDocs", "Recent5", GetSetting("AppName", "RecentDocs", "Recent4"))
SaveSetting("AppName", "RecentDocs", "Recent4", GetSetting("AppName", "RecentDocs", "Recent3"))
SaveSetting("AppName", "RecentDocs", "Recent3", GetSetting("AppName", "RecentDocs", "Recent2"))
SaveSetting("AppName", "RecentDocs", "Recent2", GetSetting("AppName", "RecentDocs", "Recent1"))
SaveSetting("AppName", "RecentDocs", "Recent1", "Your new File Name and Path")
'SaveSetting' saves data to the registry and 'GetSetting' gets data from the registry. These data will be stored under the local user's registry and will not be available if the windows user is changed.
Regards, Werries
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
:(I'm using this code to save the settings:
SaveSetting("program", "programSettings", "bgcolor", textbox1.BackColor = ColorDialog1.Color)
I'm using this code to get the settings
dim a$ = getSetting("program", "programSettings", "bgcolor")
then I used this code to assign the settings back:
me.textbox1.BackColor = new color(a)
obviously it doesn't work! can anyone help me? extremely argent my project is at a halt.
|
|
|
|
|
NANCO wrote: SaveSetting("program", "programSettings", "bgcolor", Text1.BackColor = ColorDialog1.Color)
This looks to me like it would save a boolean, the result of checking if textbox1.BackColor is the same value as ColorDialog1.Color.
This is an artefact of VB being crap, sorry. Or, I am wrong, I could be. What happens when you step through the code ? Why do you have an assignment ( or equality check, how do you tell the difference in VB ? ), inside the Save code ?
Surely your variables are not called Text1 and ColorDialog1, REALLY ???
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 )
|
|
|
|
|
I don't know; I just got the code, it doesn't work.
I will put it simply, can anyone tell me how to save and retrieve a BackColor, so I can assign it back on startup.
|
|
|
|
|
NANCO wrote: I don't know; I just got the code, it doesn't work.
Getting code off the web is fine, so long as you're able to understand it. If you can't understand it, then you should stop and work through a book, so you know enough VB.NET that the web helps you with syntax, not with writing code.
To store a color, you'd probably store the red, green and blue components as integers, then you'd use those to create a color again.
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 )
|
|
|
|
|
Hi there,
The statement 'textbox1.BackColor = ColorDialog1.Color' generates a boolen value, not the value of the color code. Do it as follow:
TextBox1.BackColor = ColorDialog1.Color
' Save to registry
SaveSetting("program", "programSettings", "bgcolor", TextBox1.BackColor.ToArgb)
' Apply from registry
Me.TextBox1.BackColor = Drawing.Color.FromArgb(GetSetting("program", "programSettings", "bgcolor"))
Regards, Werries
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
Hi! could anyone tell me how to convert a string(that is a font) that I saved to to reg using savesetting(..) to font object using getsetting(..) so I can assign it back a textbox.
summary: convert string back to font
thanx in advance.
|
|
|
|
|
Well, what is the value of the string ? Does it specify font name, size, weight, etc ?
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 )
|
|
|
|
|
Hi there,
The best is to save each setting of the font into its own registry entry, or save the settings of the font in delimited format into one registry entry and reverse it into a new font value that you can apply to the textbox.
Regards, Werries
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
I found a way, thanks anyway.
|
|
|
|
|
Hi,I'm trying to create a database connection...
connstr as string
connstr="DSN=****;uid=***;pwd=***"
.....
what do you suggest to make it more secure since the connection string is stored in the app.config.
I have tried using the rsaprotectedconfigurationprovider like what the msdn recommended...
Imports System
Imports System.Configuration
Public Class UsingRsaProtectedConfigurationProvider
' Protect the connectionStrings section.
Private Shared Sub ProtectConfiguration()
' Get the application configuration file.
Dim config As System.Configuration.Configuration = _
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
' Define the Rsa provider name.
Dim provider As String = _
"RsaProtectedConfigurationProvider"
' Get the section to protect.
Dim connStrings As ConfigurationSection = _
config.ConnectionStrings
If Not (connStrings Is Nothing) Then
If Not connStrings.SectionInformation.IsProtected Then
If Not connStrings.ElementInformation.IsLocked Then
' Protect the section.
connStrings.SectionInformation.ProtectSection(provider)
connStrings.SectionInformation.ForceSave = True
config.Save(ConfigurationSaveMode.Full)
Console.WriteLine( _
"Section {0} is now protected by {1}", _
connStrings.SectionInformation.Name, _
connStrings.SectionInformation.ProtectionProvider.Name)
Else
Console.WriteLine( _
"Can't protect, section {0} is locked", _
connStrings.SectionInformation.Name)
End If
Else
Console.WriteLine( _
"Section {0} is already protected by {1}", _
connStrings.SectionInformation.Name, _
connStrings.SectionInformation.ProtectionProvider.Name)
End If
Else
Console.WriteLine( _
"Can't get the section {0}", _
connStrings.SectionInformation.Name)
End If
End Sub 'ProtectConfiguration
' Unprotect the connectionStrings section.
Private Shared Sub UnProtectConfiguration()
' Get the application configuration file.
Dim config As System.Configuration.Configuration = _
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
' Get the section to unprotect.
Dim connStrings As ConfigurationSection = _
config.ConnectionStrings
If Not (connStrings Is Nothing) Then
If connStrings.SectionInformation.IsProtected Then
If Not connStrings.ElementInformation.IsLocked Then
' Unprotect the section.
connStrings.SectionInformation.UnprotectSection()
connStrings.SectionInformation.ForceSave = True
config.Save(ConfigurationSaveMode.Full)
Console.WriteLine( _
"Section {0} is now unprotected.", _
connStrings.SectionInformation.Name)
Else
Console.WriteLine( _
"Can't unprotect, section {0} is locked", _
connStrings.SectionInformation.Name)
End If
Else
Console.WriteLine( _
"Section {0} is already unprotected.", _
connStrings.SectionInformation.Name)
End If
Else
Console.WriteLine( _
"Can't get the section {0}", _
connStrings.SectionInformation.Name)
End If
End Sub 'UnProtectConfiguration
Public Shared Sub Main(ByVal args() As String)
Dim selection As String = String.Empty
If args.Length = 0 Then
Console.WriteLine( _
"Select protect or unprotect")
Return
End If
selection = args(0).ToLower()
Select Case selection
Case "protect"
ProtectConfiguration()
Case "unprotect"
UnProtectConfiguration()
Case Else
Console.WriteLine( _
"Unknown selection")
End Select
Console.Read()
End Sub 'Main
End Class 'UsingRsaProtectedConfigurationProvider
but I can't find system.configuration.configuration and configurationmanager.
Also, i tried searching in the object browser the configurationmanager, and it says that its part of system.configuration, but still can't find it...
|
|
|
|
|