|
Seriously?
Open the IDE, open the properties of the form, select a backgroundimage, set BackgroundImageLayout to "center". It's that easy.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Desanti wrote: Yes . I've tried that , but the image is displayed in Top Center of the form , I want that the image to be at center ( horizontally and vertically ). In WinForms, it will center. There's no TopCenter in the ImageLayout Enumeration (System.Windows.Forms)[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hello !
I'm using Vb.net 2017.
If for a form , i set the Topmost property to True , this form remain in top of other windows inside its application but also on the top of other program windows.
How can i do that a form to be Topmost only within its application ?
Thank you !
|
|
|
|
|
A MDI (multiple document interface) application perhaps; with one of the "child windows" as top most?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I don't have MDI. Just normal forms
|
|
|
|
|
desanti wrote: How can i do that a form to be Topmost only within its application ? You're responsible for the Z-order of your own windows. There's no "topmost within my app". Find the active form and put your form on it as a child.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hello,
Again, after I post the question I finally find the solution...Sorry.
The solution was to implement ParentControlDesigner to reflect the CustomRichTextBox
properties and then added this code to its custom DisplayMode() property.
If Me.DesignMode = True Then
Me.DisplayHexPage(Me._TestBuffer, 8, 0)
End If
Which only displays the test line during DesignMode. Now it works as desired.
Goal:
I have created a control inheriting a RichTextBox in which I preformat text going to the editbox.
At design time I would like to send 1 preformatted line to the editbox so that I can set the
font to display the whole line within the width of the box.
Can someone advise how to accomplish this. Thank You
Perhaps this is a starting point but maybe there is a better way.
I found the below snippet which I have modified and works with the following exceptions:
1. I must manually enter text in the RichText() property to initially display the test line.
2. When the design is saved, it also saves the formatted test text in the RichTextBox.Text property
and the text is displayed at runtime. I know that the Text property is loaded when I format the
text through DisplayHexPage().
3. The RichText() property is also added to the design info which I do not want.
Imports System.ComponentModel
Imports System.Drawing.Design
Imports System.IO
Imports System.Diagnostics
Public Class MyRtb
Inherits RichTextBox
Dim _TestBuffer() As Byte = {&H31, &H32, &H33, &H34, &H35, &H36, &H37, &H38}
<Editor(GetType(RtfEditor), GetType(UITypeEditor))> _
Public Property RichText() As String
Get
Return ""
End Get
Set(ByVal value As String)
' This is my formatting function that simply Appends("text") to the RichTextBox
Me.DisplayHexPage(Me._TestBuffer, 8, 0)
End Set
End Property
End Class
Friend Class RtfEditor
Inherits UITypeEditor
Public Overrides Function GetEditStyle(ByVal context As ITypeDescriptorContext) As UITypeEditorEditStyle
Return UITypeEditorEditStyle.Modal
End Function
Public Overrides Function EditValue(ByVal context As ITypeDescriptorContext, ByVal provider As IServiceProvider, ByVal value As Object) As Object
' Value does not matter since I am formatting text with my function
Return ""
End Function
End Class
-- modified 6-Mar-18 11:04am.
|
|
|
|
|
The combobox I populated from DB. WHen I add, update DB, this combobox is one field but if user doesn't select anything. The insert/update sql will not correct.
So how to detect this situation then warning the user.
|
|
|
|
|
If nothing is selected, the SelectedIndex property of the ComboBox instance will equal -1.
If (combo.SelectedIndex = -1)
End If
"I'm neither for nor against, on the contrary." John Middle
|
|
|
|
|
I have tried. If no selected (user does not do anything with the combobox) selected.index=0 the same when user select the first row.
I use Visual Studio 2013 and populate combobox from database using datatable like this
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim myDataSet As DataSet = New DataSet()
myDA.Fill(myDataSet, "MyTable")
Cbx_PhoneType.DataSource = myDataSet.Tables("MyTable").DefaultView
Cbx_PhoneType.ValueMember = "ID"
Cbx_PhoneType.DisplayMember = "Model Name"
cmd.Dispose()
con.Close()
|
|
|
|
|
You could do the Following :
After populating the Combobox with new data you set an additional boolean Variable (ComboBoxHelper) to false.
If the Combobox is Clicked or SelectedIndexChanged you set this Variable to True.
Now you know, that the Combobox was used by the Operator ...
|
|
|
|
|
Do you have skype. I want to contact with you for detail solution.
|
|
|
|
|
No ... sorry ... but you could reply here and also we could discuss anything ...
|
|
|
|
|
I have tried your suggestion but I fail. Do you have any OTT application such as Viber, Whatsapp, line...... We can contact easier.
Thank for your help.
|
|
|
|
|
It either happens here on Code Project or it doesn't happen at all.
|
|
|
|
|
I think you read what Dave has written. My answer is the same - sorry ...
Back to your Requirement :
You have some ComboBoxes, ListBoxes and/or TextBoxes on your Form. All of them are assigned with some values. Your problem now (as I understood) is that the User has made some inputs but sometimes he forgot (or not realize) to make a selection on the Combobox. By default your Combobox has not SelectedItem= -1 - it has SelectedItem=0 (and this could be a valid selection).
So ... what could you do now ?
One possibility is to force the user to make a selection or to touch the Combobox.
The Suggestion I gave you is to touch the Combobox. But perhaps that doesn't matches to your Requirement (if you coded I in the right way it will work).
So we could change something : the content of your Combobox don't have a valid data on Item=0. This could be done if you first insert a "-" as Item and then the correct data.
Perhaps you think about that ...
|
|
|
|
|
Right after you populate the combo box, set the SelectedIndex property to -1. Then it will be -1 if the user hasn't changed it.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
If by chance you're using Windows Forms, the combobox has an event that fires only when the user makes a selection. It's independent of the SelectedIndexchanged event. Handle the event and get the SelectedIndex property from there.
ComboBox.SelectionChangeCommitted[^]
Sometimes the true reward for completing a task is not the money, but instead the satisfaction of a job well done. But it's usually the money.
|
|
|
|
|
Buen día;
necesitaría un poco de ayuda.
Tengo un formulario de nombre "frmProcess" el cual contiene un StatusStrip de nombre "StaComment"
Por otro lado tengo un módulo el cual contiene la siguiente rutina:
Public Sub InitialMenu(lfrmActive as Form)
.
.
.
End Sub
Mi pregunta es, como hago para invocar al StatusStrip usando el parámetro form
Esto que estoy haciendo es una migración de un VB6 donde lo mismo se hacía de la siguiente forma:
Public Sub InitialMenu(lfrmActive as Form)
lfrmActive.staComment.Panels("Action").text=""
End Sub
Saludos
Translation:
od morning;
I'd need a little help.
I have a name form "FrmProcess " which contains a StatusStrip of name "StaComment "
On the other hand I have a module which contains the following routine:
Public Sub InitialMenu (lfrmActive as Form)
.
.
.
End Sub
My question is, how do I invoke the StatusStrip using the form parameter
This I am doing is a migration of a VB6 where the same was done as follows:
Public Sub InitialMenu (lfrmActive as Form)
LfrmActive. staComment. Panels ( "Action "). Text = ""
End Sub
Best regards
|
|
|
|
|
Go to the form, click on your statusstrip, and add a statuslabel. Go to properties, set "Modifiers" to public. Next, open your Module and change the code;
Public Sub InitialMenu (lfrmActive as Form)
lfrmActive.toolStripStatusLabel1.Text = "bla"
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi ALl.
I populated combobox from DB.
And now when user select the value, how can i get the ID back.Because the selectedindex id diffirent from the original ID.
Thanks.
|
|
|
|
|
Depending on what type of application you're developing, the SelectedValue should give you either the selected database ID, or a DataRowView containing the values loaded from the database.
If it doesn't, then you've not set up the binding correctly.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I just use comboboxname.text. It will be a text file. If you want to get something from the DB, forget the index and just use a sql statement "SELECT * FROM db WHERE value = '" & comboboxname.text & "'"
|
|
|
|
|
Use Value instead. Getting the ID from a table with millions of records is much quicker by ID than it is by searching for a string.
|
|
|
|
|