|
i want to add Button and imge in DataGrid Using vs.net 2003
Want an example
Ahmed El-Badry
|
|
|
|
|
you have to change the style of each column in the property:collection of you gridview to whatever you want
eg. button,combobox,checkbox,....
A.E.K
|
|
|
|
|
Thank you for your help
I want an example Plz
Thank you again
Ahmed El-Badry
|
|
|
|
|
Hello,
I have a typed dataset which I want to display in an ultragrid (infragistics) and display the parent and the children.
I can display this ok when I want to display all of the parents and children. But the user will need to select one parent from a list and display that parent with its children in the grid.
I have created the dataset schema dsAssembliedEquipment.xsd and my 2 tables assembly and AssembiledEquipment.
I have a stored procedure (getDataByCustomerID) that will find the customerID of the assembly (parent) table.
This is my code for setting the ultragrid.
<br />
'Table Adapter to get the customer ID record<br />
Me.TA_Assembly1.GetDataCustomerID(customerID)<br />
'Fill the assembly (parent) table and assembliedEquipment table(child)<br />
Me.TA_Assembly1.Fill(Me.DsAssemblyEquipment1.Assembly)<br />
Me.TA_AssembliedEquipment1.Fill(Me.DsAssemblyEquipment1.AssembliedEquipment)<br />
<br />
Me.grdCustomersAssembly.DataMember = "Assembly"<br />
Me.grdCustomersAssembly.DataSource = Me.DsAssemblyEquipment1<br />
However, this displays all of them of the parents and children.
I think this is something wrong and the dataset not getting filled correctly.
Many thanks for any direction on this,
Steve
|
|
|
|
|
Hi Steve,
you will need to add a DataRelation between the parent and child DataTable in the DataSet.
DsAssemblyEquipment1.Relations.Add(...)
See MSDN for details.
Andi
|
|
|
|
|
Hello Andi,
I will give that a try.
However, I have created in the relationship in the DsAssemblyEquipment.xsd designer.
Another thing the parent and child works when you want to display all of them in the datagrid, but if you want to display just one parent and the children that belong to that parent, that is where the trouble is. It keeps displaying all of them.
The code I gave above displayed all of them either though i have created the relationship in the xsd designer.
Any ideas,
Thanks very much.
Steve
|
|
|
|
|
Hi Steve,
sorry but I don't know, what all those designers inside VS do, because I'm not using them. I always prefer to write the code on my own so I (hopefully) know what's going on.
However, what do you mean by "displays all of them"? All parent records? Your code seems to select only one. If you mean all child records this begs the question why you select them if you only need those of one specific parent.
It's been a while since I last worked with the infragistics grid, but IIRC this kind of scenario just worked for me. Did you check for the correct setting of the grid's DataMember property? Is there a table with that name in your dataset?
Andi
|
|
|
|
|
Hello Andi,
Thanks for your reply - I did try and make the relationship in code, just to see if it made any difference
<br />
Dim parentColumn As DataColumn = Me.DsCustomerEquipment1._Assembly.Columns("AssemblyID")<br />
Dim childColumn As DataColumn = Me.DsCustomerEquipment1.AssembliedEquipment.Columns("AssemblyID")<br />
<br />
Me.DsCustomerEquipment1.Relations.Clear()<br />
Dim drAssemblies As New DataRelation("AssemblyDetails", parentColumn, childColumn)<br />
Me.DsCustomerEquipment1.Relations.Add(drAssemblies)<br />
<br />
Me.UltraGrid2.DataSource = Me.DsCustomerEquipment1<br />
<br />
Me.UltraGrid1.DataMember = "Assembly"<br />
Me.UltraGrid1.DataSource = Me.DsCustomerEquipment1<br />
Displays all of the parents and children. Which is not what I want. Let me explain I have Assembly Table fields AssemblyID | customerID | AssemblyName
I have child table called AssemblyEquipment fields SerialNo | make | Model | AssemblyID (Foreign Key)
The user will selects a customer and then the grid should display the customer's assembly and the assembly will show all the equipment that is contained in that assembly.
I have just tried this but it didn't work
<br />
'Select the parents with customerID number 2 and fill the dataset<br />
Me.AssemblyTableAdapter1.GetDataByCustomerID(2)<br />
Me.AssemblyTableAdapter1.Fill(Me.DsCustomerEquipment1._Assembly)<br />
'Set the databinding for the grid<br />
Me.UltraGrid1.SetDataBinding(Me.DsCustomerEquipment1, "Assembly")<br />
Hope you can help,
Many thanks and most grateful,
Steve
|
|
|
|
|
Hi Steve,
I see that you are working with two grids, one for the parent data and one for the children. I just used one grid to display them both. A thing which the UltraGrid does quite well.
I just dug out my old project, where I used the Infragistics grid (Version 3).
The code that works (.NET 1.1) creates a New DataSet in which two DataTables are created and filled via DataAdapter.Fill and following DataSet.Tables.Add(). The DataRelation is added just like in your code and the DataSet is bound to the grid's DataSource property. All other properties of the grid with their default values.
In the code you posted it seems that you are setting UltraGrid1's datasource twice:
Me.UltraGrid1.DataMember = "Assembly"<br />
Me.UltraGrid1.DataSource = Me.DsCustomerEquipment1
and
Me.UltraGrid1.SetDataBinding(Me.DsCustomerEquipment1, "Assembly")
Could this be the problem? Otherwise I don't have any more ideas
Andi
|
|
|
|
|
Hello Andi,
Thanks for your reply and patience.
I am only using 1 ultragrid to display the parent and children relationship.
I have set the relationship in the designer and tested to see if it would display the parents and children and it did. I also tested this doing it the code way. Also worked.
I wasn't setting the datasource twice, i tried both methods individually to see if they would work.
However, the problem is that I only want to display the parents and children that belong to a certain customer, rather they displaying all of them.
Thats the real problem, and still can't find the answer.
I think there could be a problem with the sql query or the way i am filling the dataset.
If you have any more ideas on this, please let me know. I just want to solve this problem before i pull my hair out.
Many thanks,
Steve
|
|
|
|
|
Hi Steve,
you'd better let your hair be. For me it often worked to just let it settle for a while and have a beer/whisky/milk or whatever you prefer
If the grid works as desired but does show all the assemblies of all customers, then there must be something wrong with the way you fill your dataset. At least the parent table must contain only the desired records. It doesn't matter if there are too many child records (except for the unnecessary overhead).
Things I'd have a look at in the debugger:
- do you get the correct CustomerID?
- does the query which fetches the assembly records only return those for that particular customer?
Sorry that I can't be of more help, but I'm running out of ideas as well.
Andi
|
|
|
|
|
Hi,
I'm working on a system to read in xml files( the xml files are generated from a from.designer.vb file)and create form of it. I'm looking for a way to dynamicaly create a button or a textbox so I tryed this:
Dim o As New Object<br />
o = Activator.CreateInstance(System.Type.GetType("System.Windows.Forms.Button"))
But the code above fails to work i'm always getting the same null
And my second problem is I need to set the properties of an object dynamicaly this means:
Form.controls.Item("naamofobject").text = "" <-- this is the way i know but i'm looking for a way like this:
Form.controls.Item("naamofobject").("propertynama") = "" <-- could this be possible in any way?
Thx in advance
Lodder
-- modified at 6:16 Tuesday 6th February, 2007
|
|
|
|
|
Dim oBtn as new system.windows.forms.button
oBtn.Name = "cmd"
oBtn.Text = "Press Me"
me.controls.add(obtn)
obtn.left = 100
obtn.top = 100
Dim oTxt as new system.windows.forms.textbox
oTxt.Name = "txt"
oTxt.Text = String.Empty
me.controls.add(oTxt)
oTxt.left = oBtn.Left + oBtn.width + 10
oTxt.top = 100
|
|
|
|
|
That i know but in xml files there can be 50 form controls and then i can't type it :p
|
|
|
|
|
Your original message said "I'm looking for a way to dynamicaly create a button or a textbox" what i gave you dynamically creates it. now using that technique apply it to your xml. if your still struggling...give a little sample of your xml content so I can help you apply the technique I gave you to it...
Nathan
|
|
|
|
|
This is an example of how it works and then it has to put everything on screen accordinly
<xml>
<name>button1
<text>button
<name>button2
<text>Exit
<textbox>
<name>Texty
<textbox>
<name>txtName
|
|
|
|
|
Hi all,
I have a datagridview (whose datasource is an untyped dataset) and a textbox in a form .
My grid(and dataset) has three columns.
My requirement is as the user keys in letters in the textbox the closest match should be highlighted in the grid and I must be getting autoselect options in the textbox.
For eg.Suppose I have words MICHIGAN and MICHAEL in the dataset
I key in M in the textbox ,then my textbox should have MICHAEL in it with "ICHEAL" highlighted.
The search is to be performed in only one column of the dataset.
Any help in this regards prefarably code snippets(vb.net,windows application) or approach is highly solicited
Sandy C
|
|
|
|
|
There are some good articles on this site about exactly that. I suggest you have a look at the articles section.
David Loring
!! Keep Music Live !!
|
|
|
|
|
I have a scenario in which I have aform that contains a datagridview, 2-3 labels and text boxes ,1-2 buttons on the form.
This form opens as a pop up when click a button in the parent form.Now I want to close this form when the user click any where in the parent form.
I have tried using lostfocus event of the particular form .
Please send me suitable code snippets if possible or the approach to go about it.
Looking forward to a quick reply
Sandy C
|
|
|
|
|
Sandy, close it in the activate event of the parent form.
Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
If Not IsNothing(moPopup) Then
moPopup.Close()
moPopup = Nothing
End if
End Sub
|
|
|
|
|
Why I only can deploy 1 time? When I deploy second time, error will come out.
Error 1 Deployment and/or registration failed with error: 0x8973190e. Error writing file '%CSIDL_PROGRAM_FILES%\teh\teh.exe'. Error 0x80070020: The process cannot access the file because it is being used by another process.
Device Connectivity Component
Another problem is the file in PDA also can run 1 time only, after i closed my application, i want to run it again and tap the exe file, but no response at all. Why like that??
Both of this problem can solve by reset my PDA. It is troublesome. Is it normal?
|
|
|
|
|
Because the second time, you're trying to write to a file that's been installed, and is running. Why would you deploy without removing it first ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
U meant i have to use file.delete in my coding? Or remove it manually from PDA?
I'm facing the problem with manually remove, error show that the file is running.
How can i know which activity is running?
|
|
|
|
|
... i know the way to listing all SQL server in my lan or domain and put the name of each server in a var and after store it in Shett of excel or in mdb...
Now i want to know the way, if existis, to have the same result in VB or VBA to listing all DB2 server in my Lan or Domain...
Is possible?
Tks.
|
|
|
|
|
how to connect sql server 2000 in window service in vb.net
|
|
|
|