|
<asp:DropDownList OnSelectedIndexChanged="TestFunction" runat="server" ID="ddlTesting"></asp:DropDownList>
After you have bound data to this then it should post back to the server after a drop down has occurred.
Cleako
|
|
|
|
|
hi,
how to convert an existing data in database to a string, in DataGrid
" i need something similar to : lstV.SubItems.Add(dt.Rows(i)("MTimeIN").ToString) which is used in list view" i need it in dataGrid
using vb2003
thank you
srour_costavo@hotmail.com
|
|
|
|
|
I hope I'm understanding the question correctly...
You want to replace the functionality of adding items to a ListView to an equivilent of adding items to a DataGrid, correct?
A DataGrid doesn't maintain collections of objects like a list view does. It's bound to datasources that maintain those collections. So, create a DataTable object with a DataColumn, add your items to that table and bind the DataGrid to that DataTable.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I know that in Java that "This." is required for accessing objects local to a form, etc. I also know that in VB.NET you CAN use "Me." for a similar purpose. I have never used it personally in my own code other than for Windows forms like "Me.Close()" but I have seen other people use it quite a bit and I noticed that in 1.1 the generated code always used "Me.". Is that just a programming style or is there more to it than that?
Thanks!
Cleako
|
|
|
|
|
cleako wrote: Is that just a programming style or is there more to it than that?
I think it is just a programming style. It is equivalent to this in C#, C++ and Java. Personally, I use this (or Me ) a lot because it shows intention more clearly, IMHO.
|
|
|
|
|
It's just a programming style. The compiler assumes Me. unless otherwise specified. Some people overuse it to death, putting Me. in front of everything, making the code painfully to read, even more so in the C# world with this. . It just makes your code easier to read in certain situations by taking away some abiguity, like in Property methods:
Public Class SomeClass
Private x As Integer
Public Property X() As Integer
Get
Return Me.x
End Get
Set(ByVal value As Integer)
Me.x = value
End Set
End Property
End Class
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ahhhh, thanks, that's what I've seen and I've wondered.
Cleako
|
|
|
|
|
Dave Kreskowiak wrote: Some people overuse it to death, putting Me. in front of everything, making the code painfully to read, even more so in the C# world with this
Dave Kreskowiak wrote: It just makes your code easier to read in certain situations by taking away some abiguity, like in Property methods
I hope that I am sensible with where I use this and Me . However, I do use it a lot.
|
|
|
|
|
I'm sure you don't! :->
I've just seen C# code with this. on every single line where it's legal to put it. I can only sit back and watch as those four keys scrumble to bits of plastic as this is typed about 2,000 times per class file!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I have created an class which inherits button control. In that class i have created mousedown, mouseup and paint events.
In the paint event i have resized the button size. But it is not calling the paint event.
Let me know what i was wrong, and why it is not getting into paint evnet.
Rams.
Be simple and Be sample.
|
|
|
|
|
You really shouldn't be resizing the control in the Paint event, but, whatever...
Did you call Me.Invalidate() to force the control to repaint itself?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Yes, I have tried that too, I have called the mybase.invalidate() in new() constructor and also tried putting the btnobject.invalidate() while before adding this control to form.
even it is not calling paint event.
Be simple and Be sample.
|
|
|
|
|
If your control is not redrawing after an Invalidate, you're got a serious design problem. Invalidate will send the WM_PAINT message to your control (window message pump actually) which will call your controls Paint handler. If your not getting that message or your code is doing something it shouldn't be, to prevent it from painting!, in the Paint handler, then you've got to examine how you've written your painting code.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dear,
You need to write the code in Protected Overrides onPaint Event of base class and
Develop2Program & Program2Develop
|
|
|
|
|
Hi coders,
I am planning to create an enum at runtime and set it as a property of a class.
That is,
Class MyClass
Public Property Type As (New Created Enum)
....
End Class
For creating an enum at runtime I have used the following code
Public Function CreateEnum() As [Enum]
Dim domain As AppDomain
domain = Threading.Thread.GetDomain
Dim name As New System.Reflection.AssemblyName
name.Name = "EnumCounters"
Dim asmBuilder As System.Reflection.emit.AssemblyBuilder
asmBuilder = domain.DefineDynamicAssembly(name, Reflection.Emit.AssemblyBuilderAccess.Run)
Dim modBuilder As ModuleBuilder
modBuilder = asmBuilder.DefineDynamicModule("EnumModule")
Dim enumBuilder As EnumBuilder
enumBuilder = modBuilder.DefineEnum("EnumCounters", TypeAttributes.Public, GetType(Integer))
'----- HERE IS WHERE I ADD THE ITEMS
For i As Integer = 0 To DiagManager.Counters.Count - 1
enumBuilder.DefineLiteral(CType(DiagManager.Counters(i), Counter).Caption, i)
Next
'-----
Dim enumType As Type = enumBuilder.CreateType
Dim enumObj As [Enum] = System.Activator.CreateInstance(enumType)
Return enumObj
End Function
Then, I set my property's value as the returned value of the function.
For full code please see (http://emreyazici.com/CodeFormatter.htm -- site does not have banners or advertisement. I only wrote the code)
Normally it would work. But when I assign the 'selectedobject' property of 'property grid' to the created instance of class, it does only display the FIRST item of enum in the property grid
http://emreyazici.com/res.jpg
But I want it to show all items
How may I correct it?
Thanks...
Best Regards
Emre YAZICI
|
|
|
|
|
Why are you creating an Enum at runtime?? Since an Enum is pretty much only used inside your code, I fail to see the point.
You might want to check to see if all the enum values are actually being created. It's possible that your only successfully creating one of them.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I think the problem is that your property returns a general object. Take this code for example. You'll see that the property works fine when I specifically declare it as my enumerator. However, things don't work as well if I make a simple change of declaring the property as an object. I'm not sure how to accomplish what you want but I do know this is why your having a problem.
'Requires a propertygrid
Public Class Form1
Dim test As New TestEnum
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
PropertyGrid1.SelectedObject = test
End Sub
End Class
Public Class TestEnum
Dim _TestMyEnum As MyEnum
'This works just fine because we have declared the property as MyEnum
Public Property TestMyEnum() As MyEnum
Get
Return _TestMyEnum
End Get
Set(ByVal value As MyEnum)
_TestMyEnum = value
End Set
End Property
'This returns the exact same enumerator but has been declared as a general object
'The same problem occurs here as you are seeing in your code
Public Property TestMyEnumObject() As Object
Get
Return _TestMyEnum
End Get
Set(ByVal value As Object)
_TestMyEnum = value
End Set
End Property
Public Enum MyEnum
Test0
Test1
Test2
End Enum
End Class
|
|
|
|
|
Hi,
I want to make my application compitible for Windows Vista.How do i programmatically enable the property "Run this program as an administrator" in Windows Vista?
|
|
|
|
|
Isn't that a choice that the user has to make? If you were able to override the user's level of privilege just imagine what sort of trouble viruses and trojens could create!
|
|
|
|
|
Thank you, Colin Angus Mackay for the quick response.I want to set admin privileges only to the exes of my application. How can this have adverse effect!
|
|
|
|
|
Becuase if any .EXE could just raise it's own privileges, any virus could do that same and do catastrophic damage to the O/S!! What you want to do cannot be done because you cannot raise your privileges to anything abouve what the user already has. The user has to turn this option on outside of your code.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
If it is possible, i will be making the admin privilege settings at the time of installation after getting the user's permission.Will that have any security breach.
|
|
|
|
|
Again, you can't do it from your code, even in the installation. A user cannot grant permissions above his own account.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
sp_ranjan wrote: I want to set admin privileges only to the exes of my application
Then it must be run as Admin
sp_ranjan wrote: How can this have adverse effect!
Because it could take over the user's machine without the user realising. If you need your application to run as admin you have to ask permission from the user. The user then has to make a judgement whether to trust your code.
|
|
|
|
|
Hi all
in my application i need to desply output in CommandPrompt..
and also i need to take the commands which r desplayed in command prompt..
please can u let me know.
How to desply Output in CommandPrompt....In WINDOWS APPLICATION
Thnk in advance
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|