|
-
Jul 8th, 2008, 12:11 PM
#1
Thread Starter
New Member
[2008] Few Basic Questions
Alright, I've searched the web for a while now but I can't seem to find information to these questions:
1) Does one form house all the tools and hide/show them when needed or do I call up other forms when needed?
2) Can't find a good tutorial on VB databases
3) Lastly, how could I read information from a .txt file and when displayed on the form somehow place pictures within the text at designated points. (Basically making a walkthrough with pictures to demonstrate)
Thanks in advance.
-
Jul 8th, 2008, 12:23 PM
#2
Re: [2008] Few Basic Questions
1. That depends entirely on what you have for controls, how many there are, and for what they are being used. Your up front program design will dicate how many forms you will be using.
2. Go through our Database FAQ section.
3. You can display pictures in a richtextbox after reading a text file into it. However, if you save the richtextbox back to a text file, all graphics will be lost.
-
Jul 8th, 2008, 12:28 PM
#3
Re: [2008] Few Basic Questions
1. A form will control/house all the controls you place on it. If you dont add any controls to it then it will have none.
2. DB Forum FAQ link - http://www.vbforums.com/showthread.php?t=337051
3. Not sure on what you really are trying to do but you could use a picturebox control and a label control to load the data into. What kind of layout/design are you looking for?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 8th, 2008, 01:15 PM
#4
Thread Starter
New Member
Re: [2008] Few Basic Questions
Thank you for answering the first two, for the third I think it may just be easier to load an .html file for the guide instead of making it from a text file.
However I uncovered one more question.
First, currently I'm using this code to switch between forms
Code:
Private Sub idb_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles idb.Click
itemdb.Show()
Me.Hide()
End Sub
The question with this is a) is it good protocol and b) can you close a form without closing the program?
Thanks for your help so far.
-
Jul 8th, 2008, 01:28 PM
#5
Re: [2008] Few Basic Questions
Using .Hide wil not close the form but only hide it from display which will keep a program open still if that form is your startup object.
If your form is not going to be used again then .Close it is best so it frees up the resources.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 8th, 2008, 02:52 PM
#6
Thread Starter
New Member
Re: [2008] Few Basic Questions
Now the problem I'm having is that I want the web browser control in the form to load a webpage on the harddrive. However seeing as I want thsi to work on multiple computers I can put an absolute address in there. But as far as ive tried, I cant get a relative address to work. Any suggestions?
-
Jul 8th, 2008, 03:08 PM
#7
Re: [2008] Few Basic Questions
Are you using Application.StartupPath prepended with your html file name?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 8th, 2008, 04:09 PM
#8
Thread Starter
New Member
Re: [2008] Few Basic Questions
I googled that and I think I figured out how to do what you were asking,
Code:
Dim value As String
value = Application.StartupPath
Me.WebBrowser1.Navigate(value + "qlistm.html")
However in debug it doesnt work and (for now) im not sure if it prepended it correctly.
-
Jul 8th, 2008, 08:29 PM
#9
Re: [2008] Few Basic Questions
When working in the IDE your startuppath will be the location of your build. Usually in your projects "bin\Debug" directory. Verify that you have your html file in that directory
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 8th, 2008, 08:57 PM
#10
Thread Starter
New Member
Re: [2008] Few Basic Questions
Thanks alot for thhe information so far! For now it will work, however what directory should the file be in for when I publish it?
Back to databases, I still can't work them the way I want, that is, having it display one item from x column at a time in a text box. So far I have this, but it's more me trying to frankenstein something together then actually knowing what it does.
Code:
Dim ds As DataSet
Dim strSQL As String = "SELECT [Name], [Location], [Price], [Quest Item] FROM [Items]"
Me.ItemsTableAdapter.Fill(Me.Database1DataSet1.Items)
name1.Text = Me.Database1DataSet1.Items.Tables(0).Rows(0).Item("Name").ToString()
New question: Can BASIC search strings and remove portions of them like c++? (Im looking to make a html parser)
-
Jul 8th, 2008, 09:01 PM
#11
Re: [2008] Few Basic Questions
The file would be in the same directory as the exe. The exe is the "Application" so when you access its .StartupPath" property it will be the full path to where the exe resides.
If you wanted you could contain the file in a subdirectory for a cleaner isolated look but it would be for looks only.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 8th, 2008, 09:17 PM
#12
Thread Starter
New Member
Re: [2008] Few Basic Questions
With a windows forms application I dont see an .exe when I publish it, just a autorun, setup, and application manifest, and in teh fodler created in Program Files, a application refrence.
-
Jul 8th, 2008, 09:19 PM
#13
Hyperactive Member
Re: [2008] Few Basic Questions
you dont publish if you want an exe, you build
-
Jul 8th, 2008, 09:19 PM
#14
Re: [2008] Few Basic Questions
Oh you are using Express. I dont use it much at all lol. Use the Build menu to compile the exe and then you will need to decide on how you want to distribute it by Publishing it or using ClickOnce to build an instalation package.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 8th, 2008, 09:24 PM
#15
Re: [2008] Few Basic Questions
 Originally Posted by RobDog888
Publishing it or using ClickOnce to build an instalation package.
Publishing does build a ClickOnce installation package.
-
Jul 8th, 2008, 09:29 PM
#16
Thread Starter
New Member
Re: [2008] Few Basic Questions
Oi, I found an .exe file in bin\debug but it open in VB by default so im guessing thats not it?
EDIT: Didn't find an .exe but I found an application that seems to work.
Last edited by Tenedy; Jul 8th, 2008 at 09:33 PM.
-
Jul 8th, 2008, 09:57 PM
#17
Thread Starter
New Member
Re: [2008] Few Basic Questions
One problem I've noticed though, is that when I open up a different form and hide the main one, and then close that different form, it doesn't show the main form or close the program. Any suggestions?
-
Jul 8th, 2008, 10:51 PM
#18
Addicted Member
Re: [2008] Few Basic Questions
Let's say you have 2 forms: frmOne and frmTwo. frmOne is the main form.
On frmOne there is a button: btnShowTwo.
frmOne:
vb Code:
Private Sub btnShowTwo_Click(ByVal sender As object, ByVal e As System.EventArgs) Handles btnShowTwo.Click
Dim frmShowTwo as new frmTwo(Me)
frmShowTwo.Show()
Me.Hide()
End Sub
Now on frmTwo we need to tell it that when it is closing it needs to reShow the main form.
frmTwo:
vb Code:
Dim OriginalForm as Form
Public Sub New(ByVal CallingForm As Form)
MyBase.New
InitializeComponent()
OrginalForm = CallingForm
End Sub
Private Sub frmTwo_FormClosing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
'this will close the frmTwo object
OriginalForm.Show()
End Sub
If someone has helped you, please make sure to rate them. 
-
Jul 8th, 2008, 11:03 PM
#19
Re: [2008] Few Basic Questions
Just call ShowDialog instead of Show:
vb.net Code:
Me.Hide() SomeForm.ShowDialog() Me.Show()
Tada! ShowDialog doesn't return until the form is dismissed so you can simply show the caller again immediately
-
Jul 8th, 2008, 11:34 PM
#20
Thread Starter
New Member
Re: [2008] Few Basic Questions
Alrighty, thanks.
However I'm still having the hardest time finding something on databases. Using MSDN tutorials I got some tool in there but it wasn't really what I wanted.
Basically I just want to take info from the database and place it into a textbox.
Also, I'm using a .sdf database, most other tutorials I've come across seem to use .dbm
-
Jul 9th, 2008, 12:01 AM
#21
Re: [2008] Few Basic Questions
Which database you're using is pretty much irrelevant. ADO.NET code all follows the same pattern. If you're using a different database then you simply change the connection string and, perhaps, the data namespace. Follow the Data Access link in my signature for some ADO.NET code examples. As that thread says, if you're using Access you can just change SqlClient to OleDb. If you're using SQL Server CE then you just switch SqlClient to SqlServerCe.
-
Jul 9th, 2008, 11:57 AM
#22
Thread Starter
New Member
Re: [2008] Few Basic Questions
I seem to run into trouble at this line:
Code:
Dim connection As New System.Data.SqlServerCe.SqlCeConnection("Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=C:\Users\Blake\Documents\Visual Studio 2008\Projects\Ori\Ori\Database1.sdf")
Code as a whole:
Code:
Dim connection As New System.Data.SqlServerCe.SqlCeConnection("Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=C:\Users\Blake\Documents\Visual Studio 2008\Projects\Ori\Ori\Database1.sdf")
Dim command As New System.Data.SqlServerCe.SqlCeCommand("SELECT Price, Quest Item, Name FROM Items", connection)
connection.Open()
Dim reader As System.Data.SqlServerCe.SqlCeDataReader = command.ExecuteReader()
While reader.Read()
MessageBox.Show(String.Format("There are {0} {1} of {2} remaining in stock.", _
reader("Quantity"), _
reader("Unit"), _
reader("Name")))
End While
reader.Close()
connection.Close()
-
Jul 9th, 2008, 09:38 PM
#23
Re: [2008] Few Basic Questions
That's not a valid connection string. First up, you're trying to create a SqlCeConnection with a connection string for an OleDbConnection. Secondly, that connection string would not be valid even for an OleDbConnection string because it's not complete. Go to www.connectionstrings.com and read the SSCE page carefully.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|