|
Hi,Luc! Thank you very much! I will search some articles to read
By the way,could you give me some keywords for search Thanks!
|
|
|
|
|
|
i have datagridview, i want to insert multiple rows( 5rows)
between two rows. how will i do that?
i know how to insert row between two rows but a single row.
i used: dttable.Rows.InsertAt(dRow, 0)
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
dttable.Rows is a DataGridViewRowsCollection (the MSDN page on Rows told me so), and abviously its methods are also documented in MSDN. To insert one or more rows, look for a method with a name starting with Insert...
Please make Google your friend and MSDN your bible.
|
|
|
|
|
Do you want to add rows directly into datagridview or you want to update datatable, and so datagrid view?
Anyways, I'm pasting both, it's upto you to choose the best fit for you.
Sub insertRowsInGridView(ByRef dgvRows As DataGridViewRowCollection, ByVal rowsToInsert As DataGridViewRowCollection, ByVal insertAt As Integer)
For i As Integer = rowsToInsert.Count - 1 To 0 Step -1
dgvRows.Insert(insertAt, rowsToInsert(i))
Next
End Sub
Sub insertRowsInDataTable(ByRef dtRows As DataRowCollection, ByVal rowsToInsert As DataRowCollection, ByVal insertAt As Integer)
For i As Integer = rowsToInsert.Count - 1 To 0 Step -1
dtRows.InsertAt(rowsToInsert(i), insertAt)
Next
End Sub
|
|
|
|
|
Hello All, I have added a checkbox column to my datagrid, unfortunately, the checkboxes are not selectable. What am I missing? TIA
<pre lang="vb">Private Sub chkBoxAll_Approve(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkButton.Click
Dim ctr As New DataGridViewRow
Try
For Each ctr In dgvRequests.SelectedRows
If chkBoxColumn.Selected = True Then
Exit For
ElseIf dgvRequests.CurrentRow.Cells("requestType").Value = "OOORequest" Then
Call updateOutOfOffice(LeaveStatus.Approved)
Else
Call updateRequest(LeaveStatus.Approved)
End If
Next
Catch ex As System.Exception
MessageBox.Show(ex.Message)
End Try
End Sub</pre>
|
|
|
|
|
This isn't an answer, but edit your original post and check "Use HTML in this post". That will allow your pre tags to work.
[Update]
In response to your question, it's because of the SelectionMode property. You can only have one selection mode. And the only way to allow the column to be selected is to set the SelectionMode to ColumnHeaderSelect.
Though what you are talking about has absolutely nothing to do with checkboxes within the column.
It sounds like what you really want us to see if the current row has the checkbox selected and if not, you don't do anything with it. So, instead of doing what you are saying, you need to actually check the value of that cell, not whether or not the column is selected.
modified on Wednesday, September 15, 2010 6:24 PM
|
|
|
|
|
I am creating an application in which tcp server can connect to more than one tcp client.
following is the code- where winsockServer is the winsock control in VB6 whose index property is set to 0.
----------------
Private Sub Form_Load()
'winsockServer.Protocol = sckTCPProtocol ' choose the TCP protocol
winsockServer(0).LocalPort = 2020 ' an example port number
winsockServer(0).Listen ' tell Winsock to start listening
intSockCnt = 0
End Sub
Private Sub winsockServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If intSockCnt > 2 Then
MsgBox "No. of hosts exceed....."
Else
intSockCnt = intSockCnt + 1
Load winsockServer(intSockCnt)
winsockServer(intSockCnt).Accept requestID
End If
End Sub
on compiling it is giving an error-
Procedure declaration does not match description of event or procedure having the same name
How can I do this ??????
thanks in adv..
|
|
|
|
|
Try this one;
Private Sub axWinsockListen_ConnectionRequest(ByVal requestID As Long) I wouldn't connect to many applications at once; VB6 wasn't built with multithreading support in mind.
I are Troll
|
|
|
|
|
I have 4 option buttons-
options1,options2,options3,options4
I want to add options1 and options2 in one group and options3 and option4 in another group.So that at a time one option button would be selected from each group.
How can I do this?
|
|
|
|
|
place the pairs of buttons within someother container such as a group or a panel.
Dave
Find Me On: Web| Facebook| Twitter| LinkedIn
CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.
|
|
|
|
|
Put the different groups of options buttons in separate frames
you can make the frame borders invisible if it spoils the look of the form
|
|
|
|
|
how to round this on vb.net? or how will i do this.
ex.1)
givenvalue= 3
12345 returns 12300
ex.2)
givenvalue= 4
12345 returns 12340
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
This is very simple math. In you're first example, all you do is divide the number by 100, take the integer if you don't do integer division, then multiply by 100.
|
|
|
|
|
By reading your course notes? This isn't The CodeProject Homework Hotline
Then there is what typeof rounding you want to use; http://en.wikipedia.org/wiki/Rounding[^]
See this microsoft article; How to implement custom rounding procedures[^]
One method might be to convert the number to a string, and then just work in a loop through the digits, processing as per your rounding requirements.
Other methods include working with the numbers and performing calcs on them to round.
If this isn't a homework question, it sure sounds like one!
Dave
Find Me On: Web| Facebook| Twitter| LinkedIn
CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.
modified on Wednesday, September 15, 2010 2:35 AM
|
|
|
|
|
daveauld wrote: This isn't The CodeProject Homework Hotline
You may be on to something there, but let's hide it behind a paywall and make some money!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC League Table Link
CCC Link[ ^]
|
|
|
|
|
I wanted to know is there any technique to create a hyperlink on a field value of one of the column on the datagrid in VB6.I mean,if we click on the field value in the colunm on the datagrid,it should open the document connected to that information.Can anyone please let me know the solution?
|
|
|
|
|
Possibly, this might help,
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
If TypeOf (DataGridView1.Columns(e.ColumnIndex)) Is DataGridViewLinkColumn Then
Process.Start(DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value)
End If
End Sub
|
|
|
|
|
Is this code applicable to VB6.How to use this code in VB6.Please explain.
|
|
|
|
|
sorry, that's the .Net way..
|
|
|
|
|
Then any idea how it can done using VB6 on a datagrid?
|
|
|
|
|
So i have a DataGridView on my form and added some columns in designtime.
When i run the application, i get an error:
No row can be added to a DataGridView control that does not have columns. Columns must be added first.
Wut? It says that the DGV has no columns, but it does! So i don't know why it says that it doesn't.
What can i do?
Hate.
Virtual Space Shuttle Astronaut
modified on Tuesday, September 14, 2010 6:09 PM
|
|
|
|
|
The Mighty Atom wrote: What can i do?
Calm down, think rationally, rerun the program inside your IDE (Visual Studio?), pay attention to all the details of the Exception, watch the linenumber, set a breakpoint, run again, look at the relevant variables, in short: debug, and earn your name.
|
|
|
|
|
It looks like the debugger is passing through a CheckedChange event of a radiobutton as i have set one to checked in designtime. Inside its sub, i have reference to another sub called PopulateGrid() which actually fills the DGV.
This happens BEFORE the form can even be seen. So my guess is that its trying to add rows to a DGV which has'nt been created yet. This is so weird. Is there a way to let it create the form first, and then let it execute the code to fill the DGV?
Virtual Space Shuttle Astronaut
|
|
|
|
|
Everything you did through Visual Designer is captured, converted to code and stored in files whose names end on designer.vb (they are part of your project, however they may be hidden somewhat, depends on some settings). This code gets called by the Form's constructor; most of what is there could:
1. have been coded by you instead of Visual Designer, and stored somewhere (say inside the constructor).
2. be postponed to a later point in time, such as the Form's Load event, the Form's Shown event, or even a button click handler (so you would have to click the button to populate the Form).
In particular, it could be wise to postpone the database access (and/or the data aspects of the DataGridView) till the Shown event.
BTW: the Designer-generated code needs a specific order, I hope you didn't mess that up earlier.
|
|
|
|