-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Shekhar
Message 3 in Discussion



 Hi 
vadivel,
 
    Thanks for you response...but font color is changing only when 
i select the the cell, I want parmanently it should display the font 
color...please let me know any solution for this...i tried your example and when 
i click on cell the baground color changed to aqua and font color to 
red...
 
Shekhar 


  
  
    From: <NOBR>VadivelMohanakrishnan</NOBR>
    Sent: 03/11/2003 
      15:51

  
  
    
      Hi Shekar,
       
      1. Reference the 
      Textbox property of the datagridcolumnstyle, 
      2. Create a new Font 
      object, 
      3. Set the font 
      property of the Textbox to the new Font created. 
       
      For 
      example:
       
      Dim da As New 
      SqlDataAdapter("your query", "ur connection string")
Dim ds As New 
      DataSet()
Dim dt As DataTable
       
      Dim ts As New 
      DataGridTableStyle()
Dim dgcs As DataGridColumnStyle
Dim dgtbc As 
      DataGridTextBoxColumn
       
      'Fill the 
      dataset
da.Fill(ds, "TestTable")
dt = 
      ds.Tables("TestTable")
DataGrid1.DataSource = dt
ts.MappingName = 
      dt.TableName
       
      'Add new tablestyle to the 
      datagrid
DataGrid1.TableStyles.Add(ts)
       
      'Loop through all 
      gridcolumnstyles and set the properties for the Textbox object
For Each 
      dgcs In DataGrid1.TableStyles.Item(0).GridColumnStyles
dgtbc = 
      dgcs

      With 
      dgtbc.TextBox
 .BackColor = Color.Aqua
 .ForeColor = 
      Color.Red
 Dim fnt As New Font("Arial", 8, FontStyle.Bold, 
      GraphicsUnit.Point, New Byte())
 .Font = fnt
End 
      With
Next
       
      Best Regards
      Vadivel
       
Hi Friends,
 
    I have vb.net datagrid and i want 
particular cell font color to be changed, how can i get it, i am populating the 
dataset and binding to datagrid...Please guide me on this.
 
Thanks in advance
 
Shekhar



-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to