|
Well, you can start sifting through this[^] list of articles on MSDN to try an narrow down the problem.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
tks a lot for your help man =)
|
|
|
|
|
|
Hi,
I'm fairly new to VB.Net and Windows Forms in general, and I stumbled upon a problem I can't solve.
I have this datagrid that displays various customer information. When the user clicks on a certain cell in my datagrid, I want it to select the entire row instead of one cell. Even more important: It needs to retrieve the value of the first cell of that row, which is an ID number. (This, because I want to store this value in a variable and update it to a different table)
I already know how to get the value of a selected cell by using DataGrid1.Item(DataGrid1.CurrentCell), but how do I get the value of the first cell instead? And how do I select an entire row when the user clicks one cell?
Does anybody have any idea how to do this?
Thanks!
--Erwin
-- modified at 7:43 Thursday 22nd December, 2005
|
|
|
|
|
|
Hey Erwin,
You can Use the Datagrid MouseUp Event for capture the selected value
as follows:
Private Sub DGGuest_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DGGuest.MouseUp<br />
Dim mygrid As DataGrid = CType(sender, DataGrid)<br />
Dim htiUsers As DataGrid.HitTestInfo = mygrid.HitTest(e.X, e.Y)<br />
Dim strID As String<br />
Dim iSelectedRow As Integer<br />
<br />
Select Case htiUsers.Type<br />
Case DataGrid.HitTestType.RowHeader<br />
iSelectedRow = htiUsers.Row<br />
Me.DGGuest.Select(iSelectedRow)<br />
strID = Me.DGGuest.Item(iSelectedRow, 0)<br />
MsgBox(strID)<br />
End Select<br />
<br />
End Sub
This will give the value of the 0th column cell
In this case this GuestID
Hope This works
If any doubt then mail me.
Hema Chaudhry
|
|
|
|
|
Thank you, both! My problem has been solved.
--Erwin
|
|
|
|
|
hello sir,
we r developing a project in vb.net,here by kindly request you to give some examples in using some of the controls to convert text to speech using text-to-speech controls.
prakash
|
|
|
|
|
You can use AccessibleName and AccessibleDescription properties of a control to utilize Windows' text-to-speech engine to read a description of the control. But I'm not sure if this is what you asked for?
--Erwin
|
|
|
|
|
Very easy -> Click[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
that is really easy. I just tried it here. takes less than 5 minutes to start speaking input from a textbox...cool
now to figure out how to use this new hammer
/jason
|
|
|
|
|
how can I change Datagrid Row Color based on Value in spesific row
the datagrid is Windows Application DataGrid
and the languge is VB.Net
thank for all
-- modified at 10:06 Thursday 22nd December, 2005
|
|
|
|
|
Hai,
- Your question is not clear !
|
|
|
|
|
Hi All,
I need a way to merge the column headers in the DataGrid of Windows Forms. The sample is something like this:
---------------------------------------------------------------------
| | Column 1 | Column 2 | ......... More
|Column 0 |---------------------------------------------------------
| |Sub 1 | Sub 2 | Sub 3 | Sub 1 | Sub 2 | Sub 3 | .........
---------------------------------------------------------------------
.
.
. Data for the above mentioned columns fills up here
I hope I'm able to convey my requirement clearly. I'm very thankful to The Code Project team providing us space to have duscussions. Thanks in advance to the repliers.
Regards,
Kishore
|
|
|
|
|
Hi, I was just wondering if there was a way to add classes to an ArrayList and access the subs/functions within the class from the ArrayList?
|
|
|
|
|
GBH_Badger wrote: I was just wondering if there was a way to add classes to an ArrayList and access the subs/functions within the class from the ArrayList?
I don't really understand your question. Do you mean you want to derive a new class from ArrayList? That is certainly possible.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
The following code will not work, but you see what im trying to accomplish.
Puplic Class Test
Public Sub RunTest
‘Do Stuff
End Sub
End Class
Public Class Main
‘This can be done.
Dim AL as New ArrayList
AL.Add (Test)
‘This dosent work as the sub is not exposed.
AL.Item(0).RunTest
End Class
|
|
|
|
|
Oooops, missed a sub there Still wont work though!
Puplic Class Test
Public Sub RunTest
‘Do Stuff
End Sub
End Class
Public Class Main
Public Sub RunMain
‘This can be done.
Dim AL as New ArrayList
AL.Add (Test)
‘This dosent work as the sub is not exposed.
AL.Item(0).RunTest
End Sub
End Class
|
|
|
|
|
Like Colin said, you first need to cast the item:
DirectCast(AL.Item(0), Test).RunTest
Dean
|
|
|
|
|
The sub is exposed, but you have to cast the return value of AL.Item(0) to get at it.
You can also make a strongly typed collection. See this article[^] for details and an example of how to do that in VB.NET. (Note that in .NET 2.0 this will no longer be necessary because the language supports generics)
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
OK, here is a very basic version on the code im using. Basically im using projects and need to be able to run them randomly. I started using project files (Stored in an ArrayList) and sent the project to a class which was then placed into another array and run. I then decided that I would need to pass back to much information to the project ArrayList and the GUI everytime the project was updated. I need a way for the projects to run (ie not creating project files, creating new instances of classes and saving them to disk using Serializable formatters). My actual code will need lots of events and it is a net based application and involves downloading, etc.
Still cant get the following code to work correctly. If anyone else has a better way of doing this I would be happy to dicuss it. (also im only really a hobby coder. this would be my first real application )
Public Class TestMe
Dim TestCls As Test
Dim AL As New ArrayList
Public Sub Init()
TestCls = New Test
AddHandler TestCls.onDone, AddressOf _onDone
AL.Add(TestCls)
DirectCast(AL.Item(0), Test).lngValue = 1000000000
DirectCast(AL.Item(0), Test).strName = "Test One"
AL.Add(TestCls)
DirectCast(AL.Item(1), Test).lngValue = 10000000
DirectCast(AL.Item(1), Test).strName = "Test Two"
End Sub
Public Sub RunTest(ByVal intValue As Integer)
DirectCast(AL.Item(intValue), Test).RunTest()
End Sub
Private Sub _onDone(ByVal StrName As String)
MsgBox("Done " & StrName)
End Sub
End Class
Public Class Test
Public strName As String
Public lngValue As Long
Public Event onDone(ByVal StrName As String)
Public Sub RunTest()
Dim intCounter As Long = 0
Dim X As Long = 0
'Do Long Process.
For intCounter = 0 To lngValue
X = X + 1
Next
RaiseEvent onDone(Me.strName)
End Sub
End Class
|
|
|
|
|
Excepción del tipo 'System.InvalidOperationException' en system.windows.forms.dll
Información adicional: No se pudo cargar ImageList.
Excepción del tipo 'System.Reflection.TargetInvocationException' en mscorlib.dll
Información adicional: Se inició una excepción en el destino de la invocación.
<br />
Me.iconImg.ImageSize = New System.Drawing.Size(16, 16)<br />
Me.iconImg.ImageStream = CType(resources.GetObject("iconImg.ImageStream"), System.Windows.Forms.ImageListStreamer)<br />
Me.iconImg.TransparentColor = System.Drawing.Color.Transparent<br />
I need aid I cannot do nothing, thanks of before hand.
nothing software
|
|
|
|
|
I have tried to pass a variable from User Control to others windows form. I used a textbox in windows form to show the variable. However, the User Control seems like not passing anything...
Can anyone help me to solve this?
Thanks a lot
|
|
|
|
|
The principle is exactly the same as passing between forms as a form is just a particular type of object. Form also derives from Control, as does User Control.
Here's the article: Passing Values between Forms[^]
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
I'm appending to Colin's post. Yes, UserControls can pass data just like form to form, but, you're violating encapsulation rules. A UserControl should not know anything about the form that it's sitting on. It should not care about any other controls on the form that it's sitting on.
Expose the data as a property of your control and let the form code grab the data and update other controls on the form for your control. This allows your UserControl to be reused on other forms without you knowing that you have to have certain other controls on those forms that are required by your control.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|