|
I'll bet a banana that there is in VB6.
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.
|
|
|
|
|
Yes, I'm using Visual Basic 6. Ill look up the "ItemData" object in the MSDN Library. I have some revised code that might be a little clear on this topic. I found out I was using the wrong database object to access the Database. How about this code...
Private Sub cmdLoadMasterSchedule_Click()
dlgCommonDialog.Filter = "Microsoft Access Database Applications(*.mdb)"
dlgCommonDialog.ShowOpen
Data1.Connect = dlgCommonDialog.InitDir
End Sub
Private Sub cmbListTablesInRecordSet_Click()
cmbListTablesInRecordSet.DataSource (Data1.RecordSource)
cmbListTablesInRecordSet.DataField ""
End Sub
I think this new code links to the database, but I'm still stumped on the second code part. I can access the data by clicking on the RecordSource property and choose a particular table to point too, but I still am not sure how to do it with the above code. .DataFeild and .DataSource properties still perplex me.
Any advice here with this new code?
|
|
|
|
|
D. Doulas wrote:
Any advice here with this new code? No, I don't support even the idea of writing anything new in VB6. It is a dead language and there's no good reason to use it.
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.
|
|
|
|
|
With all due respect... but do you mind? This is probably the only message board left I can find tech support for VB.
|
|
|
|
|
D. Doulas wrote: This is probably the only message board left I can find tech support for VB. I don't mind you getting help from others; I do mind the idea of actively writing VB6-code.
..and it's not tech support; its a bunch of volunteers that you are depending on to keep it alive.
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.
|
|
|
|
|
Also, a connection-string is not just a filepath.
Login Tutorial Using Access Database - Visual Basic .NET[^]; shows how to connect and read from the datbase.
D. Doulas wrote: Does anyone have any advice on this? Start with any tutorial that shows how to execute a query. Find a query that returns all table-names. Combine both ideas.
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.
|
|
|
|
|
Great idea. I look again, but that is what I couldn't find in all my text books. I think the data is being read in the combo box but it just displays a blank combo box with no data.
|
|
|
|
|
D. Doulas wrote: I look again, but that is what I couldn't find in all my text books. "That" is probably referring to the query. Found here[^].
D. Doulas wrote: I think the data is being read in the combo box but it just displays a blank combo box with no data. Why do you think that? Have you tried alternative ways of displaying the data?
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.
|
|
|
|
|
txtPart.Text = mod_ValidateDBFldType(rstOrderID!PART_NUM, rstOrderID.Fields("PART_NUM").Value)
error 1:- field is not a member of the dataset
error 2:- class 'DataSet' cannot be indexed because it has no default property.
after these errors, I changed the code but nothing works.
after changing, I got a null exception error
(1)
txtPart.Text = CType((rstOrderID.Tables("tblOrder").Rows(0)("PART_NUM")), String)
txtOrderQty.Text = CType((rstOrderID.Tables("tblOrder").Rows(0)("ORDER_QTY")), String)
(2)
txtPart.Text = (rstOrderID.Tables("tblOrder").Columns("PART_NUM").ToString)
txtOrderQty.Text = (rstOrderID.Tables("tblOrder").Columns("ORDER_QTY").ToString)
|
|
|
|
|
A DataSet object is totally different to ADODB.Recordset!
To be able to read data from DataSet, you have to refer to DataTable object corresponding to data you fetched from.
Dim dt As DataTable = YourDataSet.DataTables("YourTableName")
For Each r As DataRow in dt.Rows
Next
Dim singleRecord = YourDataSet.DataTables("YourTableName").Rows(0)
txtPart.Text = singleRecord("PART_NUM").Value
Another way to get data from DataSet is to use Linq. See: Queries in LINQ to DataSet | Microsoft Docs
|
|
|
|
|
Thanks for your reply!
I tried what you said but it did not work
|
|
|
|
|
You're not going to be able to do a line-for-line conversion of the code. You're going to have to completely rewrite it in VB.NET, with the understanding of what the goal of the original VB6 code was.
|
|
|
|
|
Just changing it will not work. There are enough tutorials out there that show how to interact with a database. Good luck.
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 !
How can I display an image at the center of a form , and this should remain at center even when I resize the form ?
Thank you !
|
|
|
|
|
Without any other info, I would make it a "full" child of the window; with or without zoom.
That'll center it.
|
|
|
|
|
Can you be more clear how can I do that ?
|
|
|
|
|
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
|
|
|
|