|
HOW TO PROVIDE DOUBLE CLICK OPTION FROM GRID CONTROL?
ANOTHER QUESTION IS
AFTER SAVING A RECORD, HOW TO REFRESH THE GRID AUTOMATICALLY?
|
|
|
|
|
for what u want to use dclick??
and answer to ur secon qustion is
after sving the record first call datasetname.clear() and then again call dataadapter.fill(datasetname,"tablename")
this will do your work
never stop from trying
|
|
|
|
|
first of all thanks for your reply.
i need to provide double click editing option from data grid control. it is for editing.
please suggest me.
|
|
|
|
|
In the code editor, locate the datagrid on the pulldown menu at the top left. Then locate DoubleClick on the pulldown menu to the right. This will create the exception block where you can place the edit code. If you simply double click on the datagrid, the exception block created is Navigate rather than DoubleClick.
|
|
|
|
|
I have an array of labels on a form. I want to track which one was clicked on (right click). Anyone know an easy way to do this?
|
|
|
|
|
Since you're referencing an array of labels I assume you're not using .NET. In that case, the MouseDown event for the control array would probably be eaisest:
Private Sub Label1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)<br />
If Button = vbRightButton Then<br />
MsgBox "Label = " & Label1(Index).Caption & " Index = " & Index<br />
End If<br />
End Sub
|
|
|
|
|
Thanks, but I am using .NET. It appears the compatability wizzard converted these, from the "VisualBasic.Compatability" class, guess I need to look at changing those as well.
Any quick suggestions as to how to go about doing this progaramatically? I need to load a bunch of labels on screen (representing slots) and allow the operator to select individual ones. The number and orientation depend on the system configuration at the time and can not be hard coded.
|
|
|
|
|
First off, the conversion wizard is the devil, just rewrite
The concept is very similar:
<br />
Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown, Label2.MouseDown<br />
If e.Button = Windows.Forms.MouseButtons.Right Then<br />
MsgBox("Label = " & sender.Name)<br />
End If<br />
End Sub<br />
This assumes you have a static "maximum" number of labels that you can keep hidden unless needed and have all of them listed on the event handles.
If you need a variable number of labels that you can't predefine then you will need to create a new label control, and assign it to the event handler. I will leave that example to someone a bit more familiar with .NET than myself.
|
|
|
|
|
First off, the conversion wizard is the devil, just rewrite
Agreed, once you have the fundamentals down, I'd suggest a complete rewrite as well.
|
|
|
|
|
in vb.net when we create a new form the code lookes like
Public Class frmlogin
Inherits Inherits System.Windows.Forms.Form
but in vb.net 2005 it doesn't work can anyone tell how to do this .i have a clss that turn form to round shape and i want to inherits that form instend of windows.forms.form
never stop from trying
|
|
|
|
|
This is definitely Monday.
I have an Excel worksheet that I am trying to get the contents of a DataGrid into.
worksheet.Cells(2, 1) = StatusGrid.Column(1).Item(1)
It would be nice if it were that simple. I was thiking of casting the datagrid into a table, but for reasons that are too cosmic to go into here, that is not possible at this time.
So... the question is.. Using VB.Net (ASP), how in the world does one reference a Cell in a datagrid?
|
|
|
|
|
Close...
StatusGrid.Items(1).Cells(1).Text()
|
|
|
|
|
So far so good. That works on bound columns beautifully.
Some of the other columns are rendered as Template columns. How would you perform the same operation on a column as defined here:
<asp:templatecolumn headertext="Date Added">
<itemtemplate>
<asp:label id="lblDateAdded" runat="server" text="<%# DataBinder.EvalContainer, "DataItem.DateAdded") %>">
<edititemtemplate>
<asp:textbox id="txtDateAdded" runat="server" text="<%# DataBinder.Eval(Container, "DataItem.DateAdded") %>" width="100%">
Thanks again in advance for all of your help.
-Ray
|
|
|
|
|
Depends on whats in em..
If you have textbox's etc in them, you'll want to look at the controls collection of the cell, or use the FindControl method to just grab it.
|
|
|
|
|
That seems to be the problem:
//-- This works well: (just a bound column)
For i = 0 To StatusGrid.Items.Count - 1
worksheet.Cells(i + 2, 1) = StatusGrid.Items(i).Cells(1).Text()
Next
//-- but when I use: (Tries to get a Template Column)
For i = 0 To StatusGrid.Items.Count - 1
worksheet.Cells(i + 2, 2) = StatusGrid.Items(i).FindControl("lblDateAdded").ToString()
Next
...the appropriate cell text reads:
"System.Web.UI.WebControls.Label"
It doesn't seem to be finding the lblDateAdded control using the above method. Do I need to be casting it?
-- modified at 18:55 Monday 3rd October, 2005
|
|
|
|
|
I wonder if someone could help me.
Example....
I have 2 forms in a project. If I select say a button to hide Form1 and show Form2. There is a button on Form2 when selected will Close Form2 but show Form1.
What I have done is as follows....
Private Sub Form1Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form1.ActiveForm.Hide()
Dim myNewForm As New Form2
'Display the calculation form
myNewForm.ShowDialog()
Form1.ActiveForm.Show()
End Sub
Private Sub Form2Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Form2.ActiveForm.Close()
End Sub
Form1 does not show and I get the following message....
An unhandled exception of type 'System.NullReferenceException' occurred in Testing.exe
Additional information: Object reference not set to an instance of an object.
Any ideas where I am going wrong.
Thanks in advance
|
|
|
|
|
Worked it out I think
Private Sub Form1Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim about As New Form2
Me.Hide()
about.ShowDialog()
Me.Show()
End Sub
|
|
|
|
|
I have a combobox(vb .net windows form application) in which I am trying to offer the user 5 selections, then based on those selections, if one is chosen I would like to offer two more selections, and so. This is similar to say having to chose a country then a state, then a city, etc. My problem is I have bound a dataview to the combobox to offer the initial 5 selections, but I cannot figure out how to proceed to offer the remaining 'nested' selections.
Not sure at all how to 'popup' the other selections after the 1st choice is made in the combobox.
Any suggestions are appreciated
-- modified at 11:06 Monday 3rd October, 2005
|
|
|
|
|
You can use the SelectedIndexChange event of combobox such that when a combobox changes its selection you update the other (nested) combobox... and so on.
e.g, if user selects a country.......update the states combo with particular state values.......and so on for the cities.......
Is there anything difficult....
_mubashir
|
|
|
|
|
Hi
I need to plot data stream coming from the serial port on a VB6 chart.
I found alot of example using mschart.ocx. But now I am using vb6, mschart.ocx is upgraded to mschrt20.ocx, so I can not run the demo program.
what should I do?
Thanks
|
|
|
|
|
I must be missing something simple....
I have a procedure that handles menu popup events,
Private Sub MenuSelect(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem1.Click, MenuItem2.Click
how do I tell from inside the procedure which one was clicked?
or even better, If I build my menu at runtime, how could I define this procedure to handle (and know which one) any menu click event? I do not know how many items until run time so I can not define them all in the procedure header.
Thanks in advance
sincerly,
Lost in context menu heck....
|
|
|
|
|
Well.. you could use diffrent procedures to handle diffrent menu items
PS:
-----------------------------------------------------------------------
Private Sub MenuSelect(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
'MenuItem1 Code Goes Here
End Sub
Private Sub MenuSelect(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
'MenuItem2 Code Goes Here
End Sub
-----------------------------------------------------------------------
Hope that helps
Life Is A Cipher Substituting "happiness" with "sadness" and Transforming "pleasure" into "pain"
|
|
|
|
|
That will not help much if I do not know the menu items at compile time.... or am I missing something?
|
|
|
|
|
I have attempted to upgrade a VB6 system to .Net that I have inherited and have to maintain and I have come across the following code that I really don't understand.
#Region "Upgrade Support "
Private Shared m_vb6FormDefInstance As frm_back
Private Shared m_InitializingDefInstance As Boolean
Public Shared Property DefInstance() As frm_back
Get
If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance = New frm_back()
m_InitializingDefInstance = False
End If
DefInstance = m_vb6FormDefInstance
End Get
Set
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
this is referenced from :-
frm_back.DefInstance.CrdVersion3 = New MultiChip.Schuler
frm_back.DefInstance.JCM = New JCM.clsJCM
can someone please explain what is going on as this program just goes away after the call to frm_back.DefInstance.JCM = New JCM.clsJCM
Regards,
Alf Stockton
|
|
|
|
|
These segments are inserted by the Upgrade Wizard to continue offering a default instance of the form. You may not need it - the wizard inserts it into every form.
e.g.,
in VB6 you could have:
myForm.Show()
without explicitly instantiating the form.
If you find that "DefInstance" is not being used anywhere, then it means the original code was not following that poor VB6 practice of using default form instances.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant C++: C# to C++ Converter
Instant J#: VB.NET to J# Converter
Clear VB: Cleans up outdated VB.NET code
|
|
|
|