Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Change Data Grid Background Colour


is it possible to change the datagrid background colour???




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Change Colour Of Particular Coloumn Of Data Grid
Dear friends ,

Is there any posibility to change colour of particulr column of Datagrid .

Zubair Khan

Change Background Colour
Hi,
I want to change the default background colour "White" of a Data Report to some other colour.
Can anyone help me regarding this?
Thanks in Advance.

Change Background Colour In Frontpage Using Vb
Im creating a website in microsoft frontpage, and I'd like to create a feature in visual basic which allows me to alter the background colour of the page im on by pressing a certain button. I have 5 command buttons, I want 1 to change background colour to red, the next white, the next black, then next yellow, and the next blue.

How would i go about doing this?

Thanks

Change Flexgrid Background Colour
is it possible to change the background colour of individual columns of an MSHFlexgrid to make it easier to read?

Trying To Change The Datagrid Row Background Colour.
Hi there,

I am struggling to find the correct syntax. I want to change the datagrid row background color based on an if statement. So far my logic is this:


query = "UPDATE customers SET "& Search_Customers.DataGrid1.BackColor & " = rgb(20,20,20) WHERE customerid = 1"

....however, the format might be to add a column name after SET.....

query = "UPDATE customers SET firstname = rgb(20,20,20) WHERE customerid = 1" (this statement updates all the data under "firstname" to rgb(20,20,20).

Thanks in advance

Simon

How To Change Background Colour Automatically??
hi

ive made a basic joke program and i was wondering how to change the bankground colour say from bacl to red constantly, i know i would have to use a timer, can anyone help?

thanks

How To Change The Background Colour Of Toolbar ?
I'm using Vb 6.0 and wish to change the background color of the toolbar? any idea of the solution.

Change Background Color Of A Cell In A Grid.
Hey
I want to change the background color of a few cells in a grid. The only way seems to be changing them one by one in a For Next loop :

Code:Grid1.Col = ColNum

           For Counter = UpRow To DownRow
               Grid1.Row = Counter
               Grid1.CellBackColor = &HC0FFFF
           Next


Well , When there are more than 10 rows in a column, the execution of the loop is somehow slow and the user can see the cells being colored one by one. I was wondering if there were a method I could specify a range of cells and then change the back color at once.

Thanks



Edited by - lucky_duke on 11/26/2004 7:42:06 AM

Data Grid View Colour
Hey,
Basically I’m creating a stock control system using visual basic, for one of my forms I am displaying data from a database table using a data grid view. The code I am using to display this data is as follows:

vb.net Code:
Imports System.DataImports System.Data.OleDbPublic Class Form3    Dim con As New OleDbConnection    Dim da As OleDbDataAdapter    Dim ds As New DataSet     Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load        con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=StockSystemDatabase.mdb"         da = New OleDbDataAdapter("SELECT * FROM tblStock", con)        da.Fill(ds, "Stock")        DataGridView1.DataSource = ds.Tables("Stock")

Now this code ^ works all well and fine and produces the data grid view like so:
http://img520.imageshack.us/img520/1746/datagz4.jpg

Now basically, I want for the stock items with no quantity (eg. Oil Lubricant) to have their whole row to be shaded in red so they are easily visible. How would I go about this and what code would I need to include to change the row colour to red.

Thank you

HOW Can I Made Just One Record In DATA Grid Colour Different??
hi,
if i had table of storage and data grid connect with this table to view all records
MY quesition:
i want the data grid view all storage content and forecolor is black
expect the the goods that it's quntity is less than 5 or 10
the forecolor of this record be red??
how can i do that???

Reversing Font Colour And Background Colour Of A Textbox
Hi guys, may I know the code to

1. reverse the font colour to white and the background of the textbox to black when an event is triggered?

How To Differentiate Between The Background Colour And The Fround Colour Of The Image????
Hi Friends!!!!

Im doing project on the Sickle Cell detection(picture is attached), anyone can please help me how to find out the Blood cells in my picture. What I want to do is I want to Differentiate the Background colour of the picture (Which is in black and white colour) with the Front coloured cells (Which are in the Red colour). I want only the red coloured blood cells in the picture. so, I want to eleminate the Background colour in the Picture.

After finding the Red coloured cell in the picture, I want to compare each cell with a Fixed radious of Red cell (Which is 7mm) and White cell (Which is 12mm). so, By doing like this I can find the actual Sickel Cells (the cells which are not round in shape but are shaped like a sicle when diseased) in the picture. This is my aim of the project.....

So, anyone who can please help me How to find out the Red cells in the picture by eleminating the Background colour.

Any help will be appreciated.

Back Colour Problem In SSTab ,Data Grid And Treeview
How to set the back colour for SSTab , Data grid and Treeview Controls.

Cell Colour Change In Response To Data
Hi all,

Just wondering if someone could tell me how to set a cell to change colour in response to a change in data.

I'm trying to build a green, amber, red indicator (or traffic light report) that changes when a cell value is greater than 10 days etc.

i.e

1/1/01 - 9/1/01 (Green)
1/1/01 - 10/1/01 (Amber)
1/1/01 - 11/1/01 (Red)

Many thanks,

Nock (Newb)

Change Colour Of Text In Vb Data Report At Run Time
I want to display a recsordset in vb data report having two fields, name and marks of student.
I want that students getting marks less than 33% show in textbox with red colour.

Please suggest me solution

How Can I Colored Data Grid Background Depend My Criteria
ihave database like this in datagrid
id rank
01 A
02 B
i want if the rank value is A datagrid background color is red ,if the rank value is B datagrid background color is blue
please help me
thanks

Unable To Change Data In The Data Grid
Dear sir/madam;

I have a form with a data grid written with VB version 8176. The project is working fine with my computer using this version 8176 but when I run the same project at school. The data grid is not allowing me to change any data in any column in the grid at all. The version of VB in school is 9899 and have SP5 as well. Could you please help me resolve this problem. My school project is due in one more week and I have to get this data grid working. Please help, please!

Thank you for your attention.

Abdul.

Data Grid: How To Enter And Change Data?
Hi, folks!

I've added a Datagrid control to my form and have set its properties like this:
AllowAddNew = false
AllowDelete = false
AllowUpdate = false, on the form load event

There's a button called "Add New", with the following module:
MyDatagrid.AllowAddNew = True
Mydatagrid.AddNewMode
But when I click this button, this error message appears:
Invalid use of property (regarding the 2nd line, property .AddNewMode

There's another button called "Changes", with the module:
MyDataGrid.AllowUpdate = True
MyDataGrid.EditActive
And the same error message appears for the .EditActive property.

What I am doing wrong?
I'd like to allow the user to change or add new records only after clicking the proper buttons. I've done with another forms, but that's the 1rst. time I work with the DataGrid Control.

Please, help!
Thanks in advance for any ideas,

Roselene

Change The Data Field In Data Grid
Hi all,

I have an ADODC control, namely Adodc1, having the sql statement as below :

sqlstr = "select to_char(IN_DATETIME,'dd-mm-yyyy hh24:mi:ss'),
, other_field from table1"

and the Adodc1 is bind to DataGrid1.
Upon clicking the IN_DATETIME column header, i wish to sort the recordset by IN_DATETIME. I use the following codes in the DataGrid1_HeadClick(ByVal ColIndex As Integer) function:
***************************************************************
strColName = DataGrid1.Columns(ColIndex).DataField
Adodc1.Recordset.Sort = strColName & " DESC"
***************************************************************

However, it gave me error as below whenever i click on the IN_DATETIME column :
****************************************************************
run-time error '3265': Ado could not find the object in the collection corresponding to the name or ordinal reference requested by the application.
****************************************************************

I believe it is because of the sql i used in Adodc1 as the data field name in Adodc1 is recognised as :
to_char(IN_DATETIME,'dd-mm-yyyy hh24:mi:ss')

Is there anyway i can set the ADODC recordset field name manually in the code? I tried :
Adodc.Recordset.Fields(ColIndex) = strColName

but it gave me the following error :
****************************************************************
run-time error '91':
Object variable or With block variable not set
***************************************************************
Due to some reasons, i must use to_char(IN_DATETIME,'dd-mm-yyyy hh24:mi:ss') in my sql instead of IN_DATETIME.

Can anyone give me some hints how should i go about it? Thanks in advance.

Data Grid Change Color Of Row
hellow

i just want to know how to change the color of the entire row when click in the dbgrid?

thnx

How To Change The Color Of Data Grid
I have Data Grid on Form and Form Backgroud is set to Dark Blue, but when I change the back color of Grid, the only Back Color of Row is changed, rest of grid color remain same. How Can I change the entrie color of Data Grid to Back Color of Form. Please help

How To Change The Back Color Of Data Grid
I have Data Grid on Form and Form Backgroud is set to Dark Blue, but when I change the back color of Grid, the only Back Color of Row is changed, rest of grid color remain same. How Can I change the entrie color of Data Grid to Back Color of Form. Please help

VB6.0 Data Grid, Odd Behaviour In Change Event
Hi All,

I have come across a problem today that is really bugging me and hope someone here can help.  Basically what is happening is the following:

1) I have a data item which reads in data from table in the database called RECURRING_FREQUENCIES, which contains two fields; RECURRING_FREQUENCY_ID and RECURRING_FREQUENCY_NAME
2) The data source is linked to a DBCombo called db_recurreceFreq
3) The Change event for the drop-down is defined as there is one option in the database, which requires some other objects to be enabled.
4) If the user selects an option other than the checked one then it all works fine, but if they do select the checked one then the BoundText portion of the drop down suddenly contains RECURRING_FREQUENCY_NAME instead of RECURRING_FREQUENCY_ID
5) I have tried recreating all the onjects, but to no avail!

My code for the Change even is as follows:

CODE    ' if it is user defined then enable the disabled text boxes
    
    
    If (Me.db_recurrenceFreq = "User-defined") Then
    
        
        Me.label_userFreq.Enabled = True
        Me.text_userInterval.Enabled = True
        Me.combo_userFrequency.Enabled = True
        Me.text_userInterval.SetFocus
        
        
        
    ' otherwise disable them
        
    Else
        Me.label_userFreq.Enabled = False
        Me.text_userInterval.Enabled = False
        Me.combo_userFrequency.Enabled = False
    End If

Change Column Font In Data Grid Control
hi..
I want to change the font of a column in data grid control, without
changing it for other columns.. is it possible to do it?? MSDN says
that each column has its own font property but i am not able to find
the way of changing it.
Anybody can help me do it.
Thanks in advance
Darsin

How Do I Change The Desktop Background After User Selects A Background From A Dropdown Selection
Hi,

I have a dropdown with 20 selections. Based on the selection I want to change the desktop background.

How would I do that?

Thanks,
Bruce

Change Data In Data Grid
Hello Friends,

I am developing one application in which I want to display data in data grid from one table. Now I want to add one column in which I want to enter data and as per entered data I want to update values in other columns. Plz can u help me how to do that using Data Grid? Plz reply soon

Thanks

Background Colour
hi, i'm using:
frmMainMenu.BackColor = RGB(col, 134, 121)

to change the background colour of my form, does anyone know what i'd use to change it back to the original (normal form colours)


thanks

Trying To Get The Right Background Colour ..
OK ... I have a colour chart showing colours and their respective hex values.

If I try and make the backolour of a form one of these colours, for example dark blue using hex value 330099, VB throws a wobbly and defaults it to black !!

I've always used the standard pallette in the past. Typical ... as soon as I start to try and be creative VB hates me !!!

Am I missing something here ?

Get The RGB Colour Of The Background
i would like to ask, how can i get the RGB colour of the background in a certain area?? Thanks in advance

Cire from HK
Eric @(^_^)@

Toolbar Background Colour
Is it possible to change the colour of the actual toolbar? Thanks

ListView Background Colour
Hello

My first post in this forum, so nice to meet you all!

I want to selectively set the background colour of items in a list view, so that the user can easily differentiate between various categories of items.

The standard:

SendMessage(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ByVal lStyle)

unfortunately seems to set the whole lot to just the one colour.

Is it even possible?

Thanks
Tarik

Problem With BAckground Colour
Im having a small problem with the Background Colour for RTB. This is my code:


Code:
cdlg.ShowColor
RichTextBox1.BackColor = cdlg.Color

Problem takes place when the user tries to change the colour of the background the first time.... even if he/she cancels, the background is changed to Black... but after that, it goes fine. Why is it like that?

Custome Background Colour
How do i set the background colour of a form to a custom colour? When i drop down the Backcolur box, theres only preset colours.

Box Colour May Match Background...
I have a code that loads pictures into my picturebox
and have this code to make boxes

VB Code:
picContainer.Line (sX, sY)-(X, Y), vbBlack, B


Obviously the

VB Code:
vbBlack

line tells the colour
How do you make it so with a combobox you can change the colour???

RichTextBox And Background Colour
Wotcha, folks.

I've been searching for a way in which to change the colour on just a selected portion of a rich text box.

We have a RTB that lists information that is then checked and coloured according to the information it finds. I.e any text with the words "problems" is highlighted in red, etc.

As we've now run out of distinguishable colours, I'd like to change the selected background colour.

There was one relatively similar question asked here earlier, but it never really went anywhere.

Is it possible to change the background colour of a selected piece of text in a RichTextBox?

Much ta.

Jack.

How To Set A Background Colour Of A Listview Row
Hello people, I want to change background colour of specified rows in a list view(in reporting mode). only way available is changing the backgroung colour of all rows but i want to change the background colour of rows what I want, not all. and also is there any way to change the colour of selected rows rather than tradiotional blue colour. Please help me with this thing. THANKS IN ADVANCE!

Changing The Background Colour
Hi

I want to make it so the suer can change the background colour of all forms with in my program. i want them to be able to have a variety of colours to choose from. what is the best way if any of doing this.

Thanks in advance

Background Colour Of Combos
I use a form for data input consisting mainly of a number of textboxes and comboboxes. Textboxes are highlighted as they get the focus by assigning a light blue background color in the gotfocus event. Thereafter the white background is restored at the lostfocus event.

Combos however become automatically painted with the same colour as the form's title bar when they get the focus. Could this be avoided? I'd like to have the combos coloured in the same light blue as the textboxes.

Form Background Colour
Hi,

This is just a simple question.

When you create a form, it's default colour is set to some vb constant. In my case, this is vbButtonFace

So, if I compile an exe and run this on another computer, will the background colour of the form change based on what settings that person has on his computer???

BackGround Colour To SStabs
Hi,

I am wanting to change the background colour of an SSTab, and before you scream at me, yes i know their is a property for this, but this is not for the colour of the actual tabs, which is what to change.
I was thinking of an API call maybe!!

Does anyone know how to write this?

Cheers

Background Colour Of A Form
How Do I set the background colour of a form on a button click.

I want to use a variable to do it.
It gets it info from 3 text boxes red, green & blue and then i say

test = test1.text + text2.text + text3.text
form1.backcolor = test

But it comes up with an error saying "Invalid Property Value"

thanks

Background Text Colour
Does anyone know how to change the BACKGROUND colour of certain sections text in a Rich edit Control... Similar to how text is highlighted with a yellow background in the VB Development environment when you get an error. Anyone got any ideas?

Before replying, please note what i am after. I know how to select text and change it's colour and font etc. what i need is how to change the background colour of certains sections of text.

Thanks people, if u have any ideas, please post a reply.

Laterz

REM

Datagrid Background Colour
does anybody know make the column in the datagrid with different
background colour, meaning that column1 is blue in colour, column2 is
yellow in colour..?

Screen Res Change Wont Change Colour Depth
Can anyone tell my why the following code that has been posted on the internet as working does not change my colour depth from 256 to 16 or 32 bit depth? I have a Matrox G400 graphics card and its set on 32 bit permanently. I am testing this screen res/colour depth change code and although i have set my display settings to 800x600x256 it resizes the screen perfectly but it wont change the colour depth regardless of what i set the dmBitsPerPel to. My Display settings remain on 256 colours.


VB Code:
' Screen Resize declarations Public Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" _(ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As Any) As Boolean Public Declare Function ChangeDisplaySettings Lib "user32" _Alias "ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwFlags As Long) As Long Public Const CCDEVICENAME = 32Public Const CCFORMNAME = 32Public Const DM_BITSPERPEL = &H40000Public Const DM_PELSWIDTH = &H80000Public Const DM_PELSHEIGHT = &H100000Public Const CDS_UPDATEREGISTRY = &H1Public Const CDS_TEST = &H4Public Const DISP_CHANGE_SUCCESSFUL = 0Public Const DISP_CHANGE_RESTART = 1Type DEVMODE    dmDeviceName As String * CCDEVICENAME    dmSpecVersion As Integer    dmDriverVersion As Integer    dmSize As Integer    dmDriverExtra As Integer    dmFields As Long    dmOrientation As Integer    dmPaperSize As Integer    dmPaperLength As Integer    dmPaperWidth As Integer    dmScale As Integer    dmCopies As Integer    dmDefaultSource As Integer    dmPrintQuality As Integer    dmColor As Integer    dmDuplex As Integer    dmYResolution As Integer    dmTTOption As Integer    dmCollate As Integer    dmFormName As String * CCFORMNAME    dmUnusedPadding As Integer    dmBitsPerPel As Integer    dmPelsWidth As Long    dmPelsHeight As Long    dmDisplayFlags As Long    dmDisplayFrequency As LongEnd Type  Public Sub ChangeScreenSettings()Dim DevM As DEVMODEDim Ans As LongDim erg As Long'Get the info into DevMerg& = EnumDisplaySettings(0&, 0&, DevM)'We don't change the colordepth, because a'rebot will be necessary DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT 'Or DM_BITSPERPELDevM.dmPelsWidth = 1024 'ScreenWidthDevM.dmPelsHeight = 768 'ScreenHeightDevM.dmBitsPerPel = 32  '(could be 8, 16, 32 or even 4) 'Now change the display and check if possibleerg& = ChangeDisplaySettings(DevM, CDS_TEST) 'Check if successfulSelect Case erg&Case DISP_CHANGE_RESTART    Ans = MsgBox("You must reboot for the new resolution to take efect!", vbYesNo + vbSystemModal, "Info")    If Ans = vbYes Then        erg& = ExitWindowsEx(EWX_REBOOT, 0&)    End IfCase DISP_CHANGE_SUCCESSFUL    erg& = ChangeDisplaySettings(DevM, CDS_UPDATEREGISTRY)Case Else    MsgBox "Your Graphics card must be able to support 1024 x 768 resolution!", vbOKOnly + vbSystemModal, "Error"End SelectEnd Sub



Any help would be appreciated
Thanks

Command Buttons Background Colour HELP!!
Im atempting to change the colour of all of the command buttons in my project, i have succesfully managed to do that with the form back colour and the MDI colour. However i cant seem to be able to changet he colour of a command button (using a combo box- with the names of colours being displayed and coding behind it) Which ever colour the user selects and the "Display" button is pressed the command buttons should change colour but they do not.

I have attempted to do it this way:

Code:
FrmEditColour.CmdDisplay.BackColor = TxtProjectedCol3.BackColor

(The Cmd Display is the command button)
(The txtProjectedCol3 is a text box with a colour in it- which should make the command button change colour)

Is there anyway of doing this, or have i done something wrong/need to modify my code?

Text Highlight - Background Colour
Hi eveyone.....

I am having a little problem with using the .backcolor property of a RichTextBox... Basicly what a what to do is highlight some text in the text box, once i have lost the focus on that selected text I would like the background behind that text to change colour and not the entire text box.

Can this be achieved...thanks for your help in advance.

Iain

:-)

Changing Background Colour With A Method
I am trying to change the background colour of an array of radio buttons using a method. The radio buttons are named "rbColours(INDEX)". There are only 4 of them, so going out of bounds shouldnt be a problem for the array.

The error I get (on run), is "Object variable or With block variable not set". I am using VB6

I know that, as far as my current code goes, this is a really long way to do it, but I hope to, once this works, do it for a much bigger project.


Private Sub Form_Load()
Dim ColourTable(3) As Data
ColourTable(0).BackColor = &H8000000F 'Grey
ColourTable(1).BackColor = &HFF& ' Red
ColourTable(2).BackColor = &HFF0000 ' Blue
ColourTable(3).BackColor = &HFF00& ' Green
End Sub

Private Sub rbColours_Click(Index As Integer)
Call ChangeColours(Index)
End Sub

Private Sub ChangeColours(Index As Integer)
rbColours(Index).BackColor = ColourTable(Index)
End Sub


PS. Thank you all for your help

Shape Background Colour Issue
I dabbled with VB about a year and a half ago but have forgotten a lot of the intricasies and now I find myself needing to create an application for some harware that I'm building but I'm stumbling.

This problem (I'm sure it won't be my last post :
I declared the use of the sleep function at the top of my program.
I have a shape (Shape 2) which represents an LED indicator. When a button is pressed, data is sent out the UDP port and the background of Shape 2 turns green. If Checkbox 7 is ticked when the button is pressed, the same udp data is sent out the udp port and the LED should turn green for 1 second then different udp data is sent and the LED (Shape 2) should turn red. It works fine when the checkbox is not ticked (send the udp data out and turns the LED background Green BUT when the checkbox is ticked, the LED (Shape 2) does not turn Green at all (the udp data is being sent though).
Essentially, with the checkbox unticked, the button serves to turn on the LED
and with the checkbox ticked, it acts like a momentary switch (on then off).
The delay is working because I can see my On, wait 1 sec then Off udp
data using a packet sniffer.
I can't help thinking that I am overlooking some small detail (as usual
Thanks, Hugh

Private Sub Command3_Click()
udp_PC.SendData &H1
Shape2.BackColor = &HC000&
If Check7.Value = 1 Then
Sleep 1000
udp_PC.SendData &HA1
Shape2.BackColor = &HFF&
End If
End Sub

Changing The Background Colour In-form.
Okay, I need to be able to change the backround colour using hotkeys, I think i have to use the numbers as Hotkeys (1,2,3,4,5,6,7,8,9,), but if that is long and/or complex, how can you do this with Cmdbuttons?

Copyright © 2005-08 www.BigResource.com, All rights reserved