This is a migrated thread and some comments may be shown as answers.

Call directamento radgridview column as native control datagridview vb.net

6 Answers 91 Views
GridView
This is a migrated thread and some comments may be shown as answers.
raffy de la cruz
Top achievements
Rank 1
raffy de la cruz asked on 14 Mar 2012, 02:55 AM
Saludos,


Como estan, tengo un problema. Agrego una columna llamada clnAsignatura al control RadGridview, pero desde el codigo no puedo hacer referencia a la misma por si sola, por ejemplo clnAsignatura.higth.  En el control estandar de vb.net el gridview, si puedo hacer esto, puedo poner en codigo el nombre de mi columna del grid directamente sin necesidad de referenciar el grid. Alguna idea de como puedo hacer esto?


regards,

As are, I have a problem. I add a column called clnAsignatura RadGridview control, but since the code I can not refer to it alone, for example clnAsignatura.higth. In standardcontrol vb.net gridview, if I can do this, I can put into code the name of my column in thegrid directly without referencing the grid. Any idea how I can do this? 

6 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 14 Mar 2012, 03:04 PM
Hola Raffy,

You should have a look at the help topic on generating columns. This will show you how to add columns to the RadGridView either programatically or automatically.

http://www.telerik.com/help/winforms/gridview-columns-generating-columns.html

Hope that helps
Richard

0
raffy de la cruz
Top achievements
Rank 1
answered on 18 Mar 2012, 04:09 PM
Thank you for your answer, but I think I expressed correctly or not you understood mewell, well as dynamically create and add them to colunmas grd, what I want is this.

I have a column in grid it is automatically generated by a datatabla and is called Student.To access this I have to do:

Dim cln = grd.Columns ("clnAlumno")
cln.Property

Once in the variable cln I can do whatever you want with it.

The problem is this. In the native grid vb.net to access student fails I have to definevariables, if I want something in this column only called
clnAlumno.Property.

As I can configure the columns to make them look radgrid without creating so variable? 
0
Richard Slade
Top achievements
Rank 2
answered on 19 Mar 2012, 10:45 AM
Hi Raffy,

I'm sorry, I don't understand what you would like to do. Please can you explain using a code exmaple?
Thanks
Richard
0
raffy de la cruz
Top achievements
Rank 1
answered on 19 Mar 2012, 06:40 PM
It's simple.


I have a radgridview a column called clnNombre takes automatically when youassign a datatable to the datasource property.


With the default griview bringing the visual studio. Net I can do something like this:

msgbox (clnNombre.FielName)


In radgridview this fails, and I have to do it this way:

Dim cln as Datagridcolum
= cln gridview1.columun ("clnNombre")

msgbox (cln.FieldName)


As I can do to access a column of radgridview directly without having to reference the radgridview. Try the basic gridview that brings the Visual Studio. Net, thisdoes not happen with. It is as if the columns were public and the code could beaccessed without any problems, just by name. 
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 20 Mar 2012, 03:41 PM
Hello,

the 2 ways to refer to the FieldName of the column would be as follows:
Hope that helps
Richard
grid.Columns(0).FieldName
grid.Columns("ColumnName").FieldName
0
Stefan
Telerik team
answered on 21 Mar 2012, 02:31 PM
Hi,

Since I am not quite sure what exactly your question is, I also assume that you want to know how to access the columns from the grid without creating a variable with it. If so, please consider Richard's answer for it.

I am marking it as answer for the thread.
 
Greetings,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
raffy de la cruz
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
raffy de la cruz
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or