|
Rupesh Kumar Swami wrote: when i copy the contents of word file to rich text box , then formatting is not proper shown .
Of course not. The RTB doesn't support everything Word does, including formatting options. You're not going to be able to "force" this to work using the RichTextBox.
|
|
|
|
|
Hi guys,
I have a program using databindings bound to a dataset. Dataset sizes vary from 2000 - 10000 rows, but form loads are very slow (when filling the datasets etc).
Does anyone have some suggestions on how to speed it up? Would it be quicker to use certain datasets instead of the WHOLE dataset of the db every time? (for example only declaring and using CRMDataset.Organisation instead of just declaring CRMDataset).
Any other ideas? I need to shave a second or 2 off the form load times.
Thanx in advance
Ed
Private Sub ManageContacts_M_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Try<br />
Me.OrganisationTableAdapter.FillWithFullName(Me.CRMDataSet.Organisation)<br />
Me.Vw_ContactsCoursesTableAdapter.Fill(Me.CRMDataSet.vw_ContactsCourses)<br />
Me.ContactTableAdapter.Fill(Me.CRMDataSet.Contact)<br />
Me.Controls.Add(Me.BindingNavigator1)<br />
<br />
'Get distinct list to populate combobox/autocomplete box<br />
Try<br />
For Each dr As DataRow In DH.RunQuery("Select DISTINCT Title FROM Contact WHERE Title <> '' AND Title IS NOT NULL ORDER BY Title ASC").Tables(0).Rows<br />
Me.TitleComboBox.Items.Add(dr("Title"))<br />
Next<br />
Catch<br />
MessageBox.Show("Could not pre-populate comboboxes")<br />
'EHC.HandleError(Err, Me)<br />
End Try<br />
Me.OrganisationBindingSource.Sort = "OrganisationName ASC"<br />
DS = DH.RunQuery("Select * FROM Users WHERE Username = '" + SystemInformation.UserName + "'") 'Gets user access rights<br />
If DS.Tables(0).Rows(0).Item("TrainingAccess") = "True" Then 'Disables button if user does not have access<br />
Me.Button2.Visible = True<br />
Else<br />
Me.Button2.Visible = False<br />
End If<br />
<br />
Me.Vw_ContactsCoursesBindingSource1.Sort = "StartDate ASC"<br />
Me.OrganisationBindingSource.Sort = "FullName ASC"<br />
Me.OrganisationBindingSource.CancelEdit() 'For some reason certain user pcs require this to be reset.<br />
Me.ContactBindingSource.CancelEdit()<br />
Me.Vw_ContactsCoursesBindingSource1.CancelEdit()<br />
Catch err As Exception<br />
Dim EHC As New ErrorHandlerClass<br />
EHC.HandleError(err, Me)<br />
End Try<br />
End Sub
modified on Tuesday, February 19, 2008 3:08 AM
|
|
|
|
|
Gr1mR33p3r wrote: Dataset sizes vary from 2000 - 10000 rows, but form loads are very slow (when filling the datasets etc).
Gr1mR33p3r wrote: Does anyone have some suggestions on how to speed it up?
Simple. Don't retrieve thousands of rows from the database if you're not going to need them frequently.
Retrieve only the columns from only the rows you need to get a form setup. If you only need 30 rows from a table, why retrieve 15,000 of them? This is probably going to require you rewriting a considerable chunk of your data code.
Gr1mR33p3r wrote: DS = DH.RunQuery("Select * FROM Users WHERE Username = '" + SystemInformation.UserName + "'") 'Gets user access rights
If DS.Tables(0).Rows(0).Item("TrainingAccess") = "True" Then 'Disables button if user does not have access
Here's an example of retrieving too much information. You're using "SELECT *" which returns all the columns for the rows specified, but you're only looking at the value of a single column and discarding the rest. Change the SQL to retrieve only that column.
SELECT TrainingAccess FROM Users WHERE Username=...
I would also highly suggest looking into using parameterized queries instead of building them with string concantenation. You're opening youreself up to SQL Injection attacks and well as making your code harder to debug using the methods you are now. Read[^]
|
|
|
|
|
When my program loads there are 3 different main panels. The first panel that comes up at runtime has a tab control on it. The first page of the tab control has a data grid that holds a weekly schedule and the second page holds an editable teacher profile.
When the program first comes up I need this dataGrid to automatically load with data. How do I load the dataGrid with data on program start up and change the schedule when a different teacher is selected?
There is also another panel that has a list box on it. The list box holds the names of different teachers. When a user clicks on the teacher name in the list box the schedule for that teacher on the first page of the tab control is supposed to load into the data grid, but it does not. Also, at program start-up the schedule for the first teacher in the list box is supposed to load into the data grid.
Being this program has several panels that each contain at least one form how should I go about loading the forms on the panels. Should I load a function for each panel when the panel comes up or should I call the function or sub procedure in the main loop of the program.
|
|
|
|
|
The tabcontrol is kind of irrelevant, you load the data at load in the form load event. You change the schedule by handling the event where the selected teacher is changed, from whatever control shows it.
You say what is 'supposed' to happen, what code have you written to make it happen ? Have you set breakpoints to see if the code executes ?
I would initialise the different views on startup, so there is no delay when the user goes between tabs.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
what do you mean by breakpoints?
|
|
|
|
|
I recommend buying a beginner book on VB.NET and working through it. A breakpoint is what you set so the debugger stops on a line of code, to allow you to examine program flow.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Here's what I'm trying to do:
- Write a VB.NET app which will set a specific service to automatically start if it's not already. I know that there's an article on codeproject.com on how to do this in C#, but either I cannot translate it, or there's something else going on.
(Here's the link to the codeproject.com article: http://www.codeproject.com/KB/system/extendservicecontroller.aspx#WMIArch[^]
Anyway, here's my code:
Dim path As String
Dim result As Integer
path = "\\" + Me.MachineName + "\root\cimv2:Win32_Service.Name=""" + Me.ServiceName + """"
Dim ManagementObj As New ManagementObject(path)
Dim Parameters(1) As Object
Parameters(0) = value.ToString()
Try
result = ManagementObj.InvokeMethod("ChangeStartMode", Parameters)
Catch ex As Exception
MessageBox.Show("Error Changing Start Mode", result.ToString(), MessageBoxButtons.OK)
End Try
...and it's not working. I don't know how to see the result code that ChangeStartMode is returning.
TIA for any help rendered.
-MC-
|
|
|
|
|
Hey Guys,
I found an article that helped me nest a datagridview within a datagridview; however, the nested datagridview doesn't scroll. I was wondering if someone could tell me what I'm missing. Here is my code, which works great when the datacolumn is frozen.
Dim dt As New DataTable
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sql As String = "SELECT distinct upc,sku,style,class_id,department,vendor FROM items a"
Dim adapter As New Odbc.OdbcDataAdapter(sql, New Odbc.OdbcConnection("DSN=tdprod;uid=ccotton;pwd=ccotton"))
If Not dt.Columns.Contains("upc") Then dt.Columns.Add("upc")
If Not dt.Columns.Contains("sku") Then dt.Columns.Add("sku")
If Not dt.Columns.Contains("style") Then dt.Columns.Add("style")
If Not dt.Columns.Contains("class_id") Then dt.Columns.Add("class_id")
If Not dt.Columns.Contains("department") Then dt.Columns.Add("department")
If Not dt.Columns.Contains("vendor") Then dt.Columns.Add("vendor")
adapter.Fill(dt)
DataGridView1.DataSource = dt
DataGridView1.Columns("upc").Frozen = True
DataGridView1.Columns("sku").Frozen = True
DataGridView1.Columns("style").Frozen = True
DataGridView1.ReadOnly = True
End Sub
Private Sub DataGridView1_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DataGridView1.CellPainting
If e.RowIndex >= 0 Then
If e.ColumnIndex >= 0 Then
If e.ColumnIndex = 2 Then
Dim list As New DataGridView
list.ReadOnly = True
Dim helpdt As New DataTable
helpdt.Columns.Add("Num")
For i As Integer = 0 To 8
Dim sub_row As DataRow = helpdt.NewRow
sub_row.Item("Num") = i + 1
helpdt.Rows.Add(sub_row)
Next
list.DataSource = helpdt
DataGridView1.Rows(e.RowIndex).Height = 100
DataGridView1.Columns(e.ColumnIndex).Width = 200
list.Width = 200
list.Height = 100
DataGridView1.Controls.Add(list)
Dim rect As Rectangle = DataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, False)
list.Location = rect.Location
End If
End If
End If
End Sub
Any help would be greatly appreciated.
Thanks.
|
|
|
|
|
has anyone here used DB2Connect to call a DB2 stored procedure. I'm having trouble registering the input/output parameters.
|
|
|
|
|
Hi everyone...
I am working on a game project in VB.NET and flash 8, which requires data stored in an ORACLE database to be retrieved on the flash interface...
I tried to integrate ORACLE and flash, but it seems like an improbable outcome, so i tried sending data from flash to VB.NET and then from the front end to the back end. Apparently, I m stuck!
Can anyone help me find a way to integrate flash 8 to VB.NET or directly to the ORACLE database. Basically i need to retrieve the scores saved on the database to the .swf file
Thanks a lot
|
|
|
|
|
Your best source of information is going to be Adobe's support and/or community forums. What you're asking is very specific to the Flash Player.
But, AFAIK, you can't do what your asking about, though my experience with Flash is very limited.
|
|
|
|
|
Hello I have a little problem that has been really bugging me.
I have a program that I made that retrieves a database table from oracle. The program allows the user to insert and update the database. These functions work great. My problem is that I can not get the delete to work because the table doesn't have a primary key defined. I am not able to change the structure of the table by adding a primary key but I would like to add the primary key in my code.
what is the syntax to add a primary key in vb. My primary key will need to be a compound key that consists of the following three columns "GROUP_NAME", "ENTITY_TYPE", "DESCRIPTION.
I am lost this is what i tried but doesnt work:
dsBaseCalc.Tables("BASE_CALC_CODES").PrimaryKey = ("GROUP_NAME")
dsBaseCalc.Tables("BASE_CALC_CODES").PrimaryKey = ("ENTITY_TYPE")
dsBaseCalc.Tables("BASE_CALC_CODES").PrimaryKey = ("DESCRIPTION")
any help would be greatly appreciated. I am a newbie
Erica
|
|
|
|
|
Never tried it, but I think you can just make an array of datacolumns to pass as the primarykey:
Dim pk3(2) As DataColumn
pk3(0) = MyDataTable.Columns("Col1")
pk3(1) = MyDataTable.Columns("Col2")
pk3(2) = MyDataTable.Columns("Col3")
MyDataTable.PrimaryKey = pk3
|
|
|
|
|
Thank you so much for that info.
Erica
|
|
|
|
|
imonfiredammit wrote: My problem is that I can not get the delete to work because the table doesn't have a primary key defined.
That's a huge mistake in designing the table schema. Nothing in your code is going to fix this. You can "patch" it by doing what your discussing, but the point behind the Primary Key is to have a field that uniquely identifies each and every record in the table. From what I've seen in your code, you cannot guarantee this. Your best course of action is to go back to the database and add a Primary Key column to the table.
|
|
|
|
|
(in WIN XP)I don't know the place in registry where I can get the exe
paths of all installed applications. However I can find the installed
applications in HLM\Software\Microsoft\Windows\Current Version\Uninstall.
I want to fetch the paths in a program from the registry.
Please help me...
|
|
|
|
|
You can't do this because that information isn't stored in the registry. The data is specific to each application, not the installer. The installer doesn't care what the path to the .EXE is, so it doesn't store that information anywhere.
|
|
|
|
|
Hello
how can i generate random numbers between 10.1 to 19.9, i mean for ex. 10.8,14.8,19.2 etc
any help
waiting for your kind help
thanks
|
|
|
|
|
<br />
dim rnd as new Random()<br />
dim val = 10.0f + (rnd.Next(99)+1.0f)/10.0f<br />
the .Next(99) method gives you a random number between 0 and 99
so (rnd.Next(99)+1.0f)/10.0f will give you a number between 0.1 and 9.9
|
|
|
|
|
hello sir
first of all thanks for your quick rep
and it's working fine
thank you very much for helping beginners like me
|
|
|
|
|
Do you want specific numbers with a step of 0.1 as in your example, or any floating point number between the values, i.e. numbers like 12.7848726343455 and 17.93847509823745?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hello sir
thanks for your rep.
yes i want any numbers like 12.7848726343455 and 17.93847509823745 as you said but only two digits after decima like 12.78 , 17.93 something like that
waiting for your kind rep.
have a nice day
thanks
|
|
|
|
|
That doesn't make it much clearer, and it also doesn't match what you originally requested.
Perhaps you can explain what is it that you are going to use it for?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hello sir
thanks again for your rep.
I just want to generate random numbers like 10.1,15.9,19.3,or 66.9,99.1 or 44.39,11.19,31.45 etc. like CKIng's help i have tried it and it's working but if you have some thing different then it's worth to know it
thanks again for your rep.
have a nice day
|
|
|
|