|
Thanks DarkElv and Yone Low very much !
Main Form: Mainform
Child Form: Form1
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form1.ControlBox = False
Form1.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Form1.Dock = DockStyle.Fill
Form1.MaximizeBox = False
Form1.MinimizeBox = False
Form1.TopLevel = False
Panel1.Controls.Add(Form1)
Form1.Show()
Form1.BringToFront()
End Sub
kaiwnyt
|
|
|
|
|
Yes you can!
for some reason Microsoft decided not to include the property in the designer, but it does indeed exist. see the code below.
Dim frm2 As New Form2
frm2.TopLevel = False
Panel1.Controls.Add(frm2)
frm2.Show()
|
|
|
|
|
Thanks
|
|
|
|
|
Hi,
My problem is that, due to large data in SQL server, my Inventry software is getting to slow while loading data from the server, is there any solution from the database side to increase the performance, or i have to change the entire code of the software, which is going to be the worst thing to do, as i have written the code in VB, I have used distributed Database Access Layer to access the data from the database.
|
|
|
|
|
Maybe you may to consider not displaying all the inventory at one go. Let the user choose the category/level or whatever or filter the list by inventory code or name, ie user type in 'A*' in name filter box and your system only shows the inventory with name started with 'A'.
|
|
|
|
|
Hi,
First of all thanks for the solution, but the problem is that i am already using filters in my software for loading the data,i am using "for loop" to append new row in the datagrid, which takes lot of time, please suggest me other solution using which i can speed up my loading data process.
|
|
|
|
|
|
Hi,
First of all thanks for the solution, but the problem is that i am already using filters in my software for loading the data,i am using "for loop" to append new row in the datagrid, which takes lot of time, please suggest me other solution using which i can speed up my loading data process.
|
|
|
|
|
Sunil,
You just answered your own question.
(Guy goes to the doctor and says "Doctor, it hurts when I do this." Doctor says, (all together now),)
"DON'T DO THAT!"
The problem is not on your database side, it is on the client side, in your code.
Yes, using a for loop and adding one record at a time is the SLOWEST way to fill the grid.
Use databinding if at all possible.
But first of all, you haven't provided enough information to really help here.
Can't fix what ya can't see.
Tell which version of VB, which datagrid component you are using, which type of backing store you are filling the grid from (ADO recordset, .Net datatable, datareader, whatever), and show the sql.
|
|
|
|
|
hi there,
how can i save a project during runtime?
i have an arena config application and when i change the displays during runtime, i need a menu to save the changes. any info?
luke
|
|
|
|
|
You can't save the project at run time, as it isn't a project when it's running, it's a program.
Save the information (to a text file, as XML or whatever you like) that you need to be able to recreate the changes when the program starts.
---
b { font-weight: normal; }
|
|
|
|
|
yes that's what i meant to save the program. isn't there a code like application.save (i know that it doesn't exist) or some sort of thing?
luke
|
|
|
|
|
No, there isn't. There's no way to save the "application state" automatically.
You have to write the code that will serialize your applications internal database (you ARE using some kind of storage to track these controls, right?) and save the information your application needs to recreate the database.
I think you're using label controls that the user can move around? How are you tracking these controls? How many controls are you allowing for? What's the bare minimum information you need to recreate each of these controls? This is the information your code will have to write to a file so you can read it back in the next time the user wants to load this "project".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello there,
i have a question.
i'm creating an arena configuration application. i have used this code to drag a label round a form.
dim dragging as boolean<br />
dim startx, starty as integer<br />
<br />
then on the mouseclick i set the dragging to true and so on...
now i want to create labels at runtime ( i know how to do that already), but my problem is how to create an addhandler for dragging.....
any ideas or code please?
luke
|
|
|
|
|
this should help: http://www.thescarms.com/dotnet/EventHandler.asp
Nathan Lindley
|
|
|
|
|
|
Cool.
Bookmarking this one.
|
|
|
|
|
Hi
i am facing a problem.
I am working with Visual basic 2005 and Sql Server 2000. I 've created an ODBC for the SQl database.
I have.'add' and 'save' buttond and 'edit' and 'update' buttons and delete, first, next, previous and last.
i wrote the following code. its not working for 'update and 'delete', giving me the following error
INVALID OPERATION EXCEPTION WAS HANDLED
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
But the same code is working for access table, imean for update also.
Somebody please help
Also tell me hw can i use ggrid in Vb2005 for display and edition?
Imports System.Data
Imports System.Data.OleDb
Imports system.Data.Odbc
Imports System.Data.Odbc.OdbcCommand
Public Class Form1
Dim con As New Odbc.OdbcConnection
Dim da As New Odbc.OdbcDataAdapter
Dim ds As New DataSet
Dim maxRows As Integer
Dim inc As Integer
Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
Clear()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "dsn=alphasql"
con.Open()
da.SelectCommand = New OdbcCommand("Select * from Company", con)
da.Fill(ds, "Company")
maxRows = ds.Tables("Company").Rows.Count
inc = -1
End Sub
Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click
Close()
End Sub
Private Sub cmdFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFirst.Click
If inc <> 0 Then
inc = 0
NavigateRecords()
Else
MsgBox("This is the first Record")
End If
End Sub
Private Sub cmdUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdUpdate.Click
con.Close()
con.Open()
da.SelectCommand = New OdbcCommand("Select * from Company", con)
da.Fill(ds, "Company")
'maxRows = ds.Tables("Company").Rows.Count
'Dim cb As Odbc.OdbcCommandBuilder = New odbccoom(da)
Dim builder As OdbcCommandBuilder = New OdbcCommandBuilder(da)
ds.Tables("Company").Rows(inc).Item(0) = txtSlNo.Text
ds.Tables("Company").Rows(inc).Item(1) = txtCode.Text
ds.Tables("Company").Rows(inc).Item(2) = txtCompanyName.Text
ds.Tables("Company").Rows(inc).Item(3) = txtCompType.Text
ds.Tables("Company").Rows(inc).Item(4) = txtRegNo.Text
ds.Tables("Company").Rows(inc).Item(5) = CDate(dtpRegDate.Value)
ds.Tables("Company").Rows(inc).Item(6) = CDate(dtpRegExpDate.Value)
ds.Tables("Company").Rows(inc).Item(7) = txtComRegNo.Text
ds.Tables("Company").Rows(inc).Item(8) = txtActivity.Text
ds.Tables("Company").Rows(inc).Item(9) = txtOwner1.Text
ds.Tables("Company").Rows(inc).Item(10) = txtOwner2.Text
ds.Tables("Company").Rows(inc).Item(11) = txtOwner3.Text
ds.Tables("Company").Rows(inc).Item(12) = txtOwner4.Text
ds.Tables("Company").Rows(inc).Item(13) = txtOwner5.Text
ds.Tables("Company").Rows(inc).Item(14) = txtCapital.Text
MsgBox("Data updated")
MsgBox(ds.Tables("Company").Rows(inc).Item(2))
'ds.Tables("Company").GetChanges()
da.Update(ds, "Company")
MsgBox("COMPLETED")
End Sub
Private Sub NavigateRecords()
txtSlNo.Text = ds.Tables("Company").Rows(inc).Item(0)
txtCode.Text = ds.Tables("Company").Rows(inc).Item(1)
txtCompanyName.Text = ds.Tables("Company").Rows(inc).Item(2)
txtCompType.Text = ds.Tables("Company").Rows(inc).Item(3)
txtRegNo.Text = ds.Tables("Company").Rows(inc).Item(4)
dtpRegDate.Value = ds.Tables("Company").Rows(inc).Item(5)
dtpRegExpDate.Value = ds.Tables("Company").Rows(inc).Item(6)
txtComRegNo.Text = ds.Tables("Company").Rows(inc).Item(7)
txtActivity.Text = ds.Tables("Company").Rows(inc).Item(8)
txtOwner1.Text = ds.Tables("Company").Rows(inc).Item(9)
txtOwner2.Text = ds.Tables("Company").Rows(inc).Item(10)
txtOwner3.Text = ds.Tables("Company").Rows(inc).Item(11)
txtOwner4.Text = ds.Tables("Company").Rows(inc).Item(12)
txtOwner5.Text = ds.Tables("Company").Rows(inc).Item(13)
txtCapital.Text = ds.Tables("Company").Rows(inc).Item(14)
End Sub
Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNext.Click
If inc <> maxRows - 1 Then
inc = inc + 1
NavigateRecords()
Else
MsgBox("No More Rows")
End If
End Sub
Private Sub cmdPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrevious.Click
If inc > 0 Then
inc = inc - 1
NavigateRecords()
Else
MsgBox("First Record")
End If
End Sub
Private Sub cmdLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLast.Click
If inc <> maxRows - 1 Then
inc = maxRows - 1
NavigateRecords()
Else
MsgBox("Last Record")
End If
End Sub
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
'inc = 0
'NavigateRecords()
MsgBox(inc)
'If inc <> -1 Then
Dim cb As New Odbc.OdbcCommandBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("Company").NewRow()
dsNewRow.Item("SlNo") = txtSlNo.Text
dsNewRow.Item("Code") = txtCode.Text
dsNewRow.Item(2) = txtCompanyName.Text
dsNewRow.Item(3) = txtCompType.Text
dsNewRow.Item(4) = txtRegNo.Text
dsNewRow.Item(5) = CDate(dtpRegDate.Value)
dsNewRow.Item(6) = CDate(dtpRegExpDate.Value)
dsNewRow.Item(7) = txtComRegNo.Text
dsNewRow.Item(8) = txtActivity.Text
dsNewRow.Item(9) = txtOwner1.Text
dsNewRow.Item(10) = txtOwner2.Text
dsNewRow.Item(11) = txtOwner3.Text
dsNewRow.Item(12) = txtOwner4.Text
dsNewRow.Item(13) = txtOwner5.Text
dsNewRow.Item(14) = txtCapital.Text
ds.Tables("Company").Rows.Add(dsNewRow)
da.Update(ds, "Company")
MsgBox("New Record added to the Database")
ds.Reset()
'End If
End Sub
Private Sub cmdDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDelete.Click
Dim cb As New Odbc.OdbcCommandBuilder(da)
ds.Tables("Company").Rows(inc).Delete()
maxRows = maxRows - 1
inc = 0
NavigateRecords()
da.Update(ds, "Company")
End Sub
Private Sub Clear()
txtSlNo.Text = ""
txtCode.Text = ""
txtCompanyName.Text = ""
txtCompType.Text = ""
txtRegNo.Text = ""
txtComRegNo.Text = ""
txtActivity.Text = ""
txtOwner1.Text = ""
txtOwner2.Text = ""
txtOwner3.Text = ""
txtOwner4.Text = ""
txtOwner5.Text = ""
txtCapital.Text = ""
End Sub
Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
|
|
|
|
|
binujeesman wrote: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
I'm guessing you haven't specified a primary key field in your table adapter/dataset.
binujeesman wrote: Also tell me hw can i use ggrid in Vb2005 for display and edition?
ggrid?
Why have you posted all the code from Form1? Surely you can narrow the problem down a bit?
|
|
|
|
|
but please tell me hw can i specify a primary key field in your table adapter/dataset.
its data grid what i meant.
pleaase help
|
|
|
|
|
A Primary Key is a field the uniquely identifies each record in a table. You have to add this field to your database tables, then update your application code accordingly.
If you don't know what a Primary Key is and its purpose, you really need to stop this project and learn relational database basics before you continue with this project. Google results for "database primary key[^]".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
Hi,
How to incorporate English dictionary in VB 6.0
Actually i want avoid spelling mistek in text box or any componant.
Please Help::
Thank U
-- modified at 6:20 Thursday 2nd November, 2006
|
|
|
|
|
The best way to do this is to use a 3rd party component to supply the dictionary functionality. Google for "vb.net spellcheck textbox[^]".
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi all,
i have searched for a long time with no result, about this subject. I need to open a web page and give the values for the textfields(user,pass) by code.
With System.Diagnostics.Proccess.Start(filename, user, pass, domain) i take an win32 exception(I cant find why!)..I try to open a site which the username & password isnt remebered (http://www.managerzone.com/index.php?lang=en&changesport=soccer).
Also, I want to make handle events on this page...like the click of a button..
Can you help me?
Thanx in advance..
Kostas
|
|
|
|