Jump to content
Xtreme .Net Talk

AndyMC

Members
  • Posts

    10
  • Joined

  • Last visited

AndyMC's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello everybody! I need to integrate my VB.net application with MS Word (Visual Studio.NET 2002, MS Word 2000 and/or 2002). For example I have to create a serial letter from within my application and I would like to fill the mail merge fields with data from my ADO.net dataset or from a XML file. Does anybody know how to achieve this? Does anybody have sample code? Do I have to use COM? Do I need MS Access as an "intermediate data source"? Thanks for help in advance Andy
  2. Unfortunately it makes no difference if constructor or load. It still doesn't work. Has nobody the same problem???
  3. Hi Robby, thanks for your answer. As the parent of the textbox is a user control. I tried the following code in the constructor of the user control (after initialize components): Me.Visible = True Me.Enabled = True Me.txtName.Visible = True Me.txtName.Enabled = True Me.txtName.Focus() But that didn't work too. As my textbox "txtName" is not a textbox but an extended control derived from Forms.Textbox I could imagine an overloaded "Focus"-method in my extendedTextbox where automatically everything will be done what has to be done (enable and make visible all parent controls). But how would I achieve that "automatically"? Any ideas?
  4. Hello there, I have trouble with the Control.Focus method. When I try to set the input focus on a textBox by using myTextbox.Focus() I get a "false" back and no focus is being set. The help explains: "A control can be selected and receive input focus if all of the following are true: its ControlStyles.Selectable style bit is set to true, it is contained in another control, and all its parent controls are both visible and enabled." So how can I ensure all the above mentioned conditions in a smart way? Does anybody know? Thanks, Andy
  5. Thanks for your reply. It works perfectly, except that we use a DataTable that is bound to the ComboBox. Because of that I had to slightly change your code: Private Function GetLongestItemWidth() As Integer Dim longest As Integer Dim str As String Dim g As Graphics = Graphics.FromImage(New Bitmap(1, 1)) Dim width As Integer Dim myDataRowView As DataRowView 'Enumerate the items in the combo For Each myDataRowView In Me.Items str = CStr(myDataRowView.Item(1)) 'Get the width of the item; if it's longer than the 'longest one so far, store it. width = CInt(g.MeasureString(str, Me.Font).Width) If width > longest Then longest = width Next Return longest End Function Thanks again Andy
  6. Hello there, does anybody know, how to set the DropDownWidth of a ComboBox to dynamically have the optimal width - adjustet to the longest entry? Meaning that every entry of the list can be read - regardless of the length of the entries? Thanks for help Andy
  7. It works perfectly. Thanks a lot!
  8. I use an ErrorProvider on my form to show errors. This works fine as long as I don't use a TabControl. When using a TabControl an error can happen on a TabPage that doesn't have the focus. So I bring the TabPage with the error to front using this code: Unfortunately this code brings the TabPage to front but it doesn't show the TabPage as being selected. myTabPage.BringToFront() myTabPage.Select() myTabPage.Show() myTabPage.Refresh() Having TabPage1, TabPage2 and TabPage3 with TabPage3 selected before validation and the error happening on TabPage1 it will show TabPage1 and it's controls but it still looks as if TabPage3 would be selected (heading "TabPage3" is in front). Has anyone an idea to solve this problem? Thanks in advance Andy
  9. I would like to cancel the SelectedIndexChanged event if a validation fails. As there is no event that I can cancel I have to write a workaround that sets the selected item back to the (remembered) old selected item if the validation fails (see code below). It works so far as that I can set back the selection to the old item but in my GUI the new selected item (that I don't want to be selected) is still selected and the old one (that I selected "manually") is not being selected. Can anyone help? Thanks in advance Andy Private Sub ctlSortableListView_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.SelectedIndexChanged Dim newSelectedIndex As Integer Dim cancel As Boolean newSelectedIndex = SelectedItemIndex RaiseEvent SelectedItemChanged(cancel, mOldSelectedIndex, newSelectedIndex) If cancel = True Then Me.Items(newSelectedIndex).Selected = False Me.Items(mOldSelectedIndex).Selected = True ' set back to old value, if canceled outside. ' This doesn't work. The selection is being changed (internally) but still the "newSelectedIndex" row seems to be selected (in the GUI) and not the "oldSelectedIndex" row. ' This seems to be a bug in the listView control!? Else mOldSelectedIndex = newSelectedIndex End If Me.Refresh() End Sub Protected Overrides Sub OnSelectedIndexChanged(ByVal e As System.EventArgs) Dim newSelectedIndex As Integer newSelectedIndex = SelectedItemIndex If newSelectedIndex <> mOldSelectedIndex And newSelectedIndex > -1 Then 'only raise event, when selection really changed ctlSortableListView_SelectedIndexChanged(Me, e) End If End Sub
  10. Forget it Heiko, you can't have everything...
×
×
  • Create New...