I can set focus to my property grid by using propgrid.Focus - but how can I
set the default property that is always first? Or just set focus to the
default property? Can this be done? 10 9999
On Sep 27, 11:40*pm, "Derek Hart" <derekmh...@yah oo.comwrote:
I can set focus to my property grid by using propgrid.Focus - but how canI
set the default property that is always first? Or just set focus to the
default property? Can this be done?
Hi Derek,
To select(or focus) a pre-defined property in a PropertyGrid control
programmaticall y, you can use loop through GridItems and check "label"
to determine which item to be selected:
'------Begin-----
Dim GridItem As GridItem = PropertyGrid1.S electedGridItem
Dim pGridItem As GridItem = GridItem.Parent
For Each egi As GridItem In pGridItem.GridI tems
If egi.Label = "property_label _here" Then
PropertyGrid1.F ocus()
egi.Select()
End If
Next
'------End-------
Hope this helps,
Onur Güzel
Thank you for the answer. Just need to add one thing to it. I am running
this code on the keydown event for a textbox control. It sets focus to the
grid properly now. But I need to trap the keystroke that was hit and fill it
in as the first character in the property, just like how Visual Studio works
when you are on a control and hit the first keyboard character and it starts
typing in the default property for that control. Is this possible?
"kimiraikko nen" <ki************ *@gmail.comwrot e in message
news:d0******** *************** ***********@2g2 000hsn.googlegr oups.com...
On Sep 27, 11:40 pm, "Derek Hart" <derekmh...@yah oo.comwrote:
I can set focus to my property grid by using propgrid.Focus - but how can
I
set the default property that is always first? Or just set focus to the
default property? Can this be done?
Hi Derek,
To select(or focus) a pre-defined property in a PropertyGrid control
programmaticall y, you can use loop through GridItems and check "label"
to determine which item to be selected:
'------Begin-----
Dim GridItem As GridItem = PropertyGrid1.S electedGridItem
Dim pGridItem As GridItem = GridItem.Parent
For Each egi As GridItem In pGridItem.GridI tems
If egi.Label = "property_label _here" Then
PropertyGrid1.F ocus()
egi.Select()
End If
Next
'------End-------
Hope this helps,
Onur Güzel
On Sep 28, 8:33*pm, "Derek Hart" <derekmh...@yah oo.comwrote:
Thank you for the answer. Just need to add one thing to it. I am running
this code on the keydown event for a textbox control. It sets focus to the
grid properly now. But I need to trap the keystroke that was hit and fillit
in as the first character in the property, just like how Visual Studio works
when you are on a control and hit the first keyboard character and it starts
typing in the default property for that control. Is this possible?
"kimiraikko nen" <kimiraikkone.. .@gmail.comwrot e in message
news:d0******** *************** ***********@2g2 000hsn.googlegr oups.com...
On Sep 27, 11:40 pm, "Derek Hart" <derekmh...@yah oo.comwrote:
I can set focus to my property grid by using propgrid.Focus - but how can
I
set the default property that is always first? Or just set focus to the
default property? Can this be done?
Hi Derek,
To select(or focus) a pre-defined property in a PropertyGrid control
programmaticall y, you can use loop through GridItems and check "label"
to determine which item to be selected:
'------Begin-----
Dim GridItem As GridItem = PropertyGrid1.S electedGridItem
Dim pGridItem As GridItem = GridItem.Parent
For Each egi As GridItem In pGridItem.GridI tems
If egi.Label = "property_label _here" Then
PropertyGrid1.F ocus()
egi.Select()
End If
Next
'------End-------
Hope this helps,
Onur Güzel
As far as i understand (i couldn't guess well maybe), you're wanting
something like IntelliSense or setting the value of a property within
textbox, and setting PropertyGrid item's value outside PropertyGrid
control is not possible, because "Value" property is ReadOnly.
Or, my another guess that if you want to highlight a property grid
item which is inside PropertyGrid control while initial key matches
with the text in textbox you can use that:
'--------------Begin-------------
Private Sub TextBox1_KeyDow n(ByVal sender As System.Object, _
ByVal e As System.Windows. Forms.KeyEventA rgs) _
Handles TextBox1.KeyDow n
Dim GridItem As GridItem = _
PropertyGrid1.S electedGridItem
Dim pGridItem As GridItem = _
GridItem.Parent
For Each egi As GridItem In _
pGridItem.GridI tems
If egi.Label.Start sWith(e.KeyData .ToString) Then
PropertyGrid1.F ocus()
egi.Select()
End If
Next
End Sub
'--------End----------
HTH,
Onur Güzel
Not quite. When I am in Visual Studio designing a form, and I highlight a
text box, when I then hit a letter, such as "T", it moves the cursor to the
property grid into the text property and enters "T" - then then user can
type the rest of the text in this property. Make sense?
"kimiraikko nen" <ki************ *@gmail.comwrot e in message
news:fe******** *************** ***********@y71 g2000hsa.google groups.com...
On Sep 28, 8:33 pm, "Derek Hart" <derekmh...@yah oo.comwrote:
Thank you for the answer. Just need to add one thing to it. I am running
this code on the keydown event for a textbox control. It sets focus to the
grid properly now. But I need to trap the keystroke that was hit and fill
it
in as the first character in the property, just like how Visual Studio
works
when you are on a control and hit the first keyboard character and it
starts
typing in the default property for that control. Is this possible?
"kimiraikko nen" <kimiraikkone.. .@gmail.comwrot e in message
news:d0******** *************** ***********@2g2 000hsn.googlegr oups.com...
On Sep 27, 11:40 pm, "Derek Hart" <derekmh...@yah oo.comwrote:
I can set focus to my property grid by using propgrid.Focus - but how
can
I
set the default property that is always first? Or just set focus to the
default property? Can this be done?
Hi Derek,
To select(or focus) a pre-defined property in a PropertyGrid control
programmaticall y, you can use loop through GridItems and check "label"
to determine which item to be selected:
'------Begin-----
Dim GridItem As GridItem = PropertyGrid1.S electedGridItem
Dim pGridItem As GridItem = GridItem.Parent
For Each egi As GridItem In pGridItem.GridI tems
If egi.Label = "property_label _here" Then
PropertyGrid1.F ocus()
egi.Select()
End If
Next
'------End-------
Hope this helps,
Onur Güzel
As far as i understand (i couldn't guess well maybe), you're wanting
something like IntelliSense or setting the value of a property within
textbox, and setting PropertyGrid item's value outside PropertyGrid
control is not possible, because "Value" property is ReadOnly.
Or, my another guess that if you want to highlight a property grid
item which is inside PropertyGrid control while initial key matches
with the text in textbox you can use that:
'--------------Begin-------------
Private Sub TextBox1_KeyDow n(ByVal sender As System.Object, _
ByVal e As System.Windows. Forms.KeyEventA rgs) _
Handles TextBox1.KeyDow n
Dim GridItem As GridItem = _
PropertyGrid1.S electedGridItem
Dim pGridItem As GridItem = _
GridItem.Parent
For Each egi As GridItem In _
pGridItem.GridI tems
If egi.Label.Start sWith(e.KeyData .ToString) Then
PropertyGrid1.F ocus()
egi.Select()
End If
Next
End Sub
'--------End----------
HTH,
Onur Güzel
On Sep 29, 1:17*am, "Derek Hart" <derekmh...@yah oo.comwrote:
Not quite. When I am in Visual Studio designing a form, and I highlight a
text box, when I then hit a letter, such as "T", it moves the cursor to the
property grid into the text property and enters "T" - then then user can
type the rest of the text in this property. *Make sense?
"kimiraikko nen" <kimiraikkone.. .@gmail.comwrot e in message
news:fe******** *************** ***********@y71 g2000hsa.google groups.com...
On Sep 28, 8:33 pm, "Derek Hart" <derekmh...@yah oo.comwrote:
Thank you for the answer. Just need to add one thing to it. I am running
this code on the keydown event for a textbox control. It sets focus to the
grid properly now. But I need to trap the keystroke that was hit and fill
it
in as the first character in the property, just like how Visual Studio
works
when you are on a control and hit the first keyboard character and it
starts
typing in the default property for that control. Is this possible?
"kimiraikko nen" <kimiraikkone.. .@gmail.comwrot e in message
news:d0******** *************** ***********@2g2 000hsn.googlegr oups.com...
On Sep 27, 11:40 pm, "Derek Hart" <derekmh...@yah oo.comwrote:
I can set focus to my property grid by using propgrid.Focus - but how
can
I
set the default property that is always first? Or just set focus to the
default property? Can this be done?
Hi Derek,
To select(or focus) a pre-defined property in a PropertyGrid control
programmaticall y, you can use loop through GridItems and check "label"
to determine which item to be selected:
'------Begin-----
Dim GridItem As GridItem = PropertyGrid1.S electedGridItem
Dim pGridItem As GridItem = GridItem.Parent
For Each egi As GridItem In pGridItem.GridI tems
If egi.Label = "property_label _here" Then
PropertyGrid1.F ocus()
egi.Select()
End If
Next
'------End-------
Hope this helps,
Onur Güzel
As far as i understand (i couldn't guess well maybe), you're wanting
something like IntelliSense or setting the value of a property within
textbox, and setting PropertyGrid item's value outside PropertyGrid
control is not possible, because "Value" property is ReadOnly.
Or, my another guess that if you want to highlight a property grid
item which is inside PropertyGrid control while initial key matches
with the text in textbox you can use that:
'--------------Begin-------------
Private Sub TextBox1_KeyDow n(ByVal sender As System.Object, _
ByVal e As System.Windows. Forms.KeyEventA rgs) _
Handles TextBox1.KeyDow n
Dim GridItem As GridItem = _
PropertyGrid1.S electedGridItem
Dim pGridItem As GridItem = _
GridItem.Parent
For Each egi As GridItem In _
pGridItem.GridI tems
If egi.Label.Start sWith(e.KeyData .ToString) Then
PropertyGrid1.F ocus()
egi.Select()
End If
Next
End Sub
'--------End----------
HTH,
Onur Güzel
Now got it what you desribe in VS. But couldn't associate your aim
with a textbox and typing in a defaul property of a propertygrid
control. For example, you can make a property default by using
"DefaultPropert yAttribute" in your class, for example you can design
your class whose default property is "Title" as follows:
<DefaultPropert yAttribute("Tit le")_
Public Class SampleProperty
Private _Title As String
<CategoryAttrib ute("Applicatio n"), _
Browsable(True) , _
[ReadOnly](False), _
BindableAttribu te(False), _
DefaultValueAtt ribute(""), _
DesignOnly(Fals e), _
DescriptionAttr ibute("Enter Title for the application")_
Public Property Title() As String
Get
Return _Title
End Get
Set(ByVal Value As String)
_Title = Value
End Set
End Property
Now, when you associate that class with PropertyGrid using:
"PropertyGrid1. SelectedObject = New SampleProperty" preferably in
form1_load event, "Title" property is pre-selected in gray and when
you type in a textbox using the code above, it gets focus in blue and
starts to type the value of that property.
Sorry, if i got wrong,
Hope this helps,
Onur Güzel
Not sure I understand how this will solve the problem. In Visual Studio, if
I design a text box, then highlight it and hit a keyboard character, it will
set focus to the property grid, and enter that character in the "text"
property waiting for more input. Can I recreate this somehow?
"kimiraikko nen" <ki************ *@gmail.comwrot e in message
news:1a******** *************** ***********@f36 g2000hsa.google groups.com...
On Sep 29, 1:17 am, "Derek Hart" <derekmh...@yah oo.comwrote:
Not quite. When I am in Visual Studio designing a form, and I highlight a
text box, when I then hit a letter, such as "T", it moves the cursor to
the
property grid into the text property and enters "T" - then then user can
type the rest of the text in this property. Make sense?
"kimiraikko nen" <kimiraikkone.. .@gmail.comwrot e in message
news:fe******** *************** ***********@y71 g2000hsa.google groups.com...
On Sep 28, 8:33 pm, "Derek Hart" <derekmh...@yah oo.comwrote:
Thank you for the answer. Just need to add one thing to it. I am running
this code on the keydown event for a textbox control. It sets focus to
the
grid properly now. But I need to trap the keystroke that was hit and
fill
it
in as the first character in the property, just like how Visual Studio
works
when you are on a control and hit the first keyboard character and it
starts
typing in the default property for that control. Is this possible?
"kimiraikko nen" <kimiraikkone.. .@gmail.comwrot e in message
news:d0******** *************** ***********@2g2 000hsn.googlegr oups.com...
On Sep 27, 11:40 pm, "Derek Hart" <derekmh...@yah oo.comwrote:
I can set focus to my property grid by using propgrid.Focus - but how
can
I
set the default property that is always first? Or just set focus to
the
default property? Can this be done?
Hi Derek,
To select(or focus) a pre-defined property in a PropertyGrid control
programmaticall y, you can use loop through GridItems and check "label"
to determine which item to be selected:
'------Begin-----
Dim GridItem As GridItem = PropertyGrid1.S electedGridItem
Dim pGridItem As GridItem = GridItem.Parent
For Each egi As GridItem In pGridItem.GridI tems
If egi.Label = "property_label _here" Then
PropertyGrid1.F ocus()
egi.Select()
End If
Next
'------End-------
Hope this helps,
Onur Güzel
As far as i understand (i couldn't guess well maybe), you're wanting
something like IntelliSense or setting the value of a property within
textbox, and setting PropertyGrid item's value outside PropertyGrid
control is not possible, because "Value" property is ReadOnly.
Or, my another guess that if you want to highlight a property grid
item which is inside PropertyGrid control while initial key matches
with the text in textbox you can use that:
'--------------Begin-------------
Private Sub TextBox1_KeyDow n(ByVal sender As System.Object, _
ByVal e As System.Windows. Forms.KeyEventA rgs) _
Handles TextBox1.KeyDow n
Dim GridItem As GridItem = _
PropertyGrid1.S electedGridItem
Dim pGridItem As GridItem = _
GridItem.Parent
For Each egi As GridItem In _
pGridItem.GridI tems
If egi.Label.Start sWith(e.KeyData .ToString) Then
PropertyGrid1.F ocus()
egi.Select()
End If
Next
End Sub
'--------End----------
HTH,
Onur Güzel
Now got it what you desribe in VS. But couldn't associate your aim
with a textbox and typing in a defaul property of a propertygrid
control. For example, you can make a property default by using
"DefaultPropert yAttribute" in your class, for example you can design
your class whose default property is "Title" as follows:
<DefaultPropert yAttribute("Tit le")_
Public Class SampleProperty
Private _Title As String
<CategoryAttrib ute("Applicatio n"), _
Browsable(True) , _
[ReadOnly](False), _
BindableAttribu te(False), _
DefaultValueAtt ribute(""), _
DesignOnly(Fals e), _
DescriptionAttr ibute("Enter Title for the application")_
Public Property Title() As String
Get
Return _Title
End Get
Set(ByVal Value As String)
_Title = Value
End Set
End Property
Now, when you associate that class with PropertyGrid using:
"PropertyGrid1. SelectedObject = New SampleProperty" preferably in
form1_load event, "Title" property is pre-selected in gray and when
you type in a textbox using the code above, it gets focus in blue and
starts to type the value of that property.
Sorry, if i got wrong,
Hope this helps,
Onur Güzel
"Derek Hart" <de********@yah oo.comwrote in message
news:eA******** ******@TK2MSFTN GP03.phx.gbl...
Not sure I understand how this will solve the problem. In Visual Studio,
if I design a text box, then highlight it and hit a keyboard character, it
will set focus to the property grid, and enter that character in the
"text" property waiting for more input. Can I recreate this somehow?
Remember that the PropertyGrid has an object assigned to it that serves as
the source of the data it displays. I think what you need to do is alter
that object so that your desired property now contains the character that
was typed and then set your focus to the PropertyGrid and the property.
Sounds like you want to use a macro in VS.
"Derek Hart" wrote:
Not sure I understand how this will solve the problem. In Visual Studio, if
I design a text box, then highlight it and hit a keyboard character, it will
set focus to the property grid, and enter that character in the "text"
property waiting for more input. Can I recreate this somehow?
Thanks for the different information. Just can't get it working. If I have
a textbox highlighted (remember, I am in runtime mode with custom code that
draws a rectangle around the textbox), then I hit a keystroke, it does set
focus to the property grid, and sets focus to the property.
Now I tried this code:
CType(propGrid. SelectedObject, PropertiesLabel ).LabelName =
e.KeyData.ToStr ing
propGrid.Refres h
So now when I hit a keystroke, it does fill in the first character into the
grid. But here is the tricky part. It does not open the property up for
editing. It sets focus to the property. Now the user hits another keystroke
and it types over the first one. Is is possible after the Refresh is done,
to open up the property for editing, and be in the second character
position?
"atalanta" <at******@discu ssions.microsof t.comwrote in message
news:9C******** *************** ***********@mic rosoft.com...
Sounds like you want to use a macro in VS.
"Derek Hart" wrote:
>Not sure I understand how this will solve the problem. In Visual Studio, if I design a text box, then highlight it and hit a keyboard character, it will set focus to the property grid, and enter that character in the "text" property waiting for more input. Can I recreate this somehow?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bryan Masephol |
last post by:
Hi All
I got a datagrid and a ComboBox on a form. I populate the combobox with
years for all the data avaiable. When the user chooses a year the datagrid
is populated with the specific years information.
Problem... when the users scrolls the datagrid with the mouse wheel it work
for 2 wheel clicks and then for some reason the focus...
|
by: Ian Oldbury |
last post by:
i do a postback on a field within a dot.net datagrid (in editmode) and need
to set the focus to a specific field within the grid. Has anyone done this,
any suggestions?
|
by: Kent P. Iler |
last post by:
Hi,
I am showing/hiding a variety of panels that have different text boxes via
code-behind functions. Depending on the condition, I would like to have the
focus be set on a specific text box. However, all examples I've seen do
this from the client side.
Does anyone have a way to easily to specify the textbox to focus on from a...
|
by: Mark Vergara |
last post by:
Hello,
Somebody help on this.
I have my Data Grid, and I want to focus on
the last row of the grid cell let say for example
I have my New button for my Adding a new record
private sub btnNew_Click(Byval sender as object, Byval e as
System.EventArgs)
CurrencyManager.AddNew
|
by: Tosch |
last post by:
I have a usercontrol with a label, a textbox, a treeview, a grid and a
couple of checkboxes.
The usercontrol is hosted on a form together with a cancel and a
accept button. This form is used to search records in a database.
On several forms in my application I show (modal) this form to search
records. Everytime I show the form I want the...
| |
by: DBC User |
last post by:
I would like to know how to set a focus to a datarow? (using
datarow.selected=true, select the row but does not show the row on the
screen visible if it is below/above the grid display area).
|
by: foolmelon |
last post by:
Before AJAX, we were able to focus a cell in a gridview during a
fullpage postback. After putting the gridview inside an UpdatePanel,
we cannot focus a cell in this gridview anymore. Does anybody know if
it is possible to make such focus? Thanks!
Bill
|
by: Derek Hart |
last post by:
I can set focus to my property grid by using propgrid.Focus - but how can I
set the default property that is always first? Or just set focus to the
default property? Can this be done?
|
by: Andrus |
last post by:
Steps to reproduce issue:
1. Run code.
2. Enter some data to grid
3. Click other form caption
4. Click original form caption
5. Enter some characters
Observed: entered characters are ignored
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |