|
I ran your code and it worked without error.
|
|
|
|
|
in vb.net how to use controlcollection to group all similar controls
|
|
|
|
|
A ControlCollection is not used for that. The Controls property of a control, which contains the children of the control, is a ControlCollection.
In what way do you want to group the controls?
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
I am making a button control. It is inheriting UserControl. I have everything complete except the damned click event, I can't seem to get it to fire. Any suggestions?
Tibmeister
|
|
|
|
|
Hi, I've had the same problem. This is how I solved it :
The click event from the button isn't reachable outside the usercontrol.
But inside the usercontrol it is. So you have to handle the event inside the usercontrol and throw up a new event which is reachable outside the usercontrol.
A little code:
- create a control whith a button on it and add the following code to it:
- handle the event and raise a new one
Public Class UCButton
...
Public Event buttonKlik(ByVal sender As System.Object, ByVal e As System.EventArgs)
...
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles Button1.Click
RaiseEvent buttonKlik(sender,e)
End Sub
...
End Class
- in the class or whatever where the new event has to be handled :
...
AddHandler Me.btnCommit.buttonKlik , AddressOf Me.commit_klik
...
Public Sub commit_klik(ByVal sender As System.Object, ByVal e As System.EventArgs)
...
do what you have to to
...
End Sub
Ron
|
|
|
|
|
Okay, I think the problem I may be running into the is there is no actual button control on the usercontrol. My "button" is actually a Panel with some custom drawing happening to it. I'm trying to capture the click event of the Panel, then pass it through.
|
|
|
|
|
And in looking at stuff, that is exactly what was happening. Thanks for the tip, you got me thinking in the right direction.
|
|
|
|
|
I'm glad you could use it.
Ron
|
|
|
|
|
Hello.
I need to create application using VB.NET that will parse csv file and import data into the database. I tried to read csv file but it returns funky characters. Did anyone had experience with this.
Thanks in advance.
Alex.
|
|
|
|
|
Perhaps if you posted your code, we could tell you why it's broken. In VS2005, there's static methods on the File class in System.IO that will read an entire file as a string array, and the split method on the string class will turn a string with commas in it into a string array also.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
The problem is I don't have code. I just used something I used in the previous project to read a text file. If you can kindly point me into the right direction I woudl really appreciate that.
Thank you,
|
|
|
|
|
alexfromto wrote: If you can kindly point me into the right direction I woudl really appreciate that.
I thought I'd done that ?
http://msdn2.microsoft.com/en-us/library/db5x7c0d.aspx[^] is a good starting point for the reading of text. Use the method that returns a string []. Each string is a line in your file. Iterate over these, and use the split method on each string, using the , as a delimiter, you'll get back a new string []. Each string is now a field.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
When I set the background image of a form whether it is opened already or not. It doesnt work. I have an MDI form with the option of changing backgrounds. When one of these is selected it uses an image from my.resources. The MDI background changes but the other forms backgrounds that are supposed to change do not. Not when these forms are opened and not when they are closed... HELP!!!!!!
(Sorry, Dave, I thought I had figured it out...)
|
|
|
|
|
Well, you probably want to add a property that stores the background image to use, and then uses that image right away if the form is open, or reads it when it is opened.
If it's not working when your form is open, then your code must be quite wrong. How are you accessing the other forms ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Believe it or not, I can not figure out how to reference the 'My' object in my VB.net 2005 smart client app. What do I need to import?
|
|
|
|
|
You shouldn't have to reference anything, Visual Studio should recognize it automatically (unless a reference is not properly set).
If it is not, you could try referencing it like so:
Imports ProjectName.My
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
That didn't work. What did you mean by a reference improperly set?
|
|
|
|
|
Well, you could try going into your Project's Properties and clicking on the References tab. There at the bottom you should see a list of all references set in your project. Make sure that the Microsoft.VisualBasic and ProjectName.My references are checked. This may be causing the problem. If that doesn't help, then Import the same references in the code also.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Thank you fo your reply.
Microsoft.VisualBasic is checked.
Project.My (CRM_SmartClient.My) is not found on the list.
Is there a My assembly I need to add from somewhere?
|
|
|
|
|
pa28140 wrote: Project.My (CRM_SmartClient.My) is not found on the list.
It's kind of hard to find. But it should be on there.
Do you need to use the My Statement? Because you can always use the System namespace (which does everything My does and a lot more).
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Hello,
VS 2005
I have program that on first run will run after installed will setup a server connection. The next times the program is run it will not execute this code to setup the server as it was done in the first run.
I can't use clickOnce IsFirstRun as the customer doesn't want that used for installation.
I am using MSI to create the setup. I right click setup | view | Registry. I create a key value, example "HKEY_CURRENT_USER\Software\Reality", "App", "Installed"
I set the property AlwaysCreate = false, and DeleteAtUninstall = true.
My big question I don't want to create the key value when the application is first installed. Only delete it when uninstalled.
My code for checking for the key value:
<br />
If (My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\Reality", "App", Nothing) <> "Installed") Then<br />
'The program is running for the first time so create key value My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\RealitySolutions", "CodeRed", "Installed")<br />
'Setup server for the fist time<br />
<br />
Else<br />
'The key exists so no need to setup the server<br />
'Do something else<br />
End If<br />
The key value deletes on the uninstalled - which is what i want it to do. However, it always creates the key value when installed. i don't want it to do this. It should only create the key value in the code.
Can any tell me, when setting up the registry in the setup project, is there a way to stop it from creating the key value when the program is installed.
I thought by setting the AllwaysCreate property to false would stop this.
many thanks for your ideas,
Steve
|
|
|
|
|
The Data Grid (at class level):
Protected WithEvents dgProducts As System.Web.UI.WebControls.DataGrid
Setting up the event handler (in a method called from Form_Load):
AddHandler dgProducts.ItemDataBound, AddressOf dgProducts_ItemDataBound
The event handler:
Private Sub dgProducts_ItemDataBound(ByVal sender As System.Object, ByVal e As DataGridItemEventArgs)
dgItemDataBound(sender, e, dgProducts, "ddl_4")
End Sub
The problem (VB.Net, ASP.Net v1.1):
A breakpoint set on the single line of this event handler is never hit even though this DataGrid does contain a DataBound column that does display data.
-- modified at 12:12 Wednesday 20th December, 2006
Eric
|
|
|
|
|
I have an MDI application with the option of changing the background. Some of the child forms open maximized and I want them to have the same background as the MDI parent. This is what I have:
If frmMainMDI.BackgroundImage = My.Resources.TurquoiseBack Then
Form.ActiveForm.ActiveMdiChild.BackgroundImage = My.Resources.TurquoiseBack
And so on and so on for each background the user can choose from.... This code is in a setbackground() sub in a global module. Each time one of these maximized child forms open I run the Setbackground sub.
on the " frmMainMDI.BackgroundImage = My.Resources.TurquoiseBack " I get a squiggly and it says that operator " = " is not defined for system.drawing.image and system.drawing.bitmap.
The wierd thing is that if I type this same thing in after my "then" of the if statement I do not get the squiggly... This is kind of hard to explain because there is alot more to the way I am trying to accomplish this but this is just the part that is confusing me. Please, anyone that knows why I am getting this, please help me. Thank you!!!
|
|
|
|
|
Joey Picerno wrote: on the " frmMainMDI.BackgroundImage = My.Resources.TurquoiseBack " I get a squiggly and it says that operator " = " is not defined for system.drawing.image and system.drawing.bitmap.
It says this because you're trying to compare an Image object to an Image object, which you can't do.
Why are you checking to see if the Background image is equal to something? If the rest of your explanation is any indicator, you shouldn't even have to check this. Your SetBackground code should just set the BackgroundImage and BackColor of all your forms without regard to what they currently are.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
when the user selects a new background (from images in my.resources) the MDI parent background changes. When they open say the Employee form (a child form that when opened stays maximized) I want that forms background image to change to the same one as the MDI parent's. The code I am working with is in a seperate module from these forms. thank you for your assistance with this.
|
|
|
|