10 Replies - 4024 Views - Last Post: 29 May 2012 - 08:02 AM Rate Topic: -----

#1 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Saving datagridview row to access database with colour

Posted 28 May 2012 - 07:37 AM

Hi all I have a function that i use to save a datagridview row to an access database (which works fine) but i was wondering any one know what i should look up to figure out how to set the row that i am saving to a colour IN the access database.

So the row that i save is say red in the access database.
Is This A Good Question/Topic? 0
  • +

Replies To: Saving datagridview row to access database with colour

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8372
  • View blog
  • Posts: 31,117
  • Joined: 12-June 08

Re: Saving datagridview row to access database with colour

Posted 28 May 2012 - 11:19 AM

Have an integer column and use a consistent enum so 0 = no color, 1 = red, 2 = blue.. etc... or if you want more granularity save the whole RGB color tri number..
Was This Post Helpful? 0
  • +
  • -

#3 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Re: Saving datagridview row to access database with colour

Posted 28 May 2012 - 11:34 AM

I understand the enum part but how do i export the colored row to Access

    Enum color
	red = 1
	Blue = 2
    End Enum
'Then my datagridview row was say:

'1/john/white

'I would then want to export 1/john/White to access and have to row in Access highlighted in red this is the part i don't know where to start


This post has been edited by m_wylie85: 28 May 2012 - 11:41 AM

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8372
  • View blog
  • Posts: 31,117
  • Joined: 12-June 08

Re: Saving datagridview row to access database with colour

Posted 28 May 2012 - 11:43 AM

When you are setting up your parameters to insert into your database you throw in a switch statement..
dim lColorParam as int32 = 0

select case <where you are holding your row's color attribute>
case red:
 lcolorparam = 1
case green:
 lcolorparam = 2
... 
end select

sqlcommand.param.addwith value(@lColor, lcolorparam)

Was This Post Helpful? 1
  • +
  • -

#5 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Re: Saving datagridview row to access database with colour

Posted 29 May 2012 - 02:32 AM

Hey tring what you said but i couldn't get it to work so i was searching through condtional formatting in Access I found out what i am tring to do can't be done. I know it can be done in excel but Access do not offer that funtionallty in the datasheet
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8372
  • View blog
  • Posts: 31,117
  • Joined: 12-June 08

Re: Saving datagridview row to access database with colour

Posted 29 May 2012 - 06:46 AM

No.. seriously.. it can. If you can store a number in an access table (which we know you can) you can do this. Just abstract it. The key part is *YOU* are in charge of making the transition from row color to number and back again.

How are you coloring your rows?
Was This Post Helpful? 0
  • +
  • -

#7 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Re: Saving datagridview row to access database with colour

Posted 29 May 2012 - 07:23 AM

I am confused. I don't know how to color the rows in an Access database that was i am asking

if i save data from a datagridview to an Access DB

Data:

12342/john/white/notActioned

Because this data has 'notActioned' in i would then like the line IN the access db to be highlight to red when i save the line.

If this can be done can you please link me to a tutorial as i have looked (Alot) through google and can't find anything like this

I may be just being stupid here but i am not following you

This post has been edited by m_wylie85: 29 May 2012 - 07:24 AM

Was This Post Helpful? 0
  • +
  • -

#8 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1533
  • View blog
  • Posts: 4,919
  • Joined: 25-September 09

Re: Saving datagridview row to access database with colour

Posted 29 May 2012 - 07:34 AM

Are you wanting the DataSheet view in access to actually display those colors? Is that what you're asking?

There is a format field in the Access design that states you can apply colors but I've not used it.

By clicking on a field, clicking the Format and pressing F1 the following help is displayed.
Attached Image

This might give you enough information to generate a more specific search
Was This Post Helpful? 0
  • +
  • -

#9 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Re: Saving datagridview row to access database with colour

Posted 29 May 2012 - 07:44 AM

"Are you wanting the DataSheet view in access to actually display those colors? Is that what you're asking?"

Yes Charlie that is excatly what i am try to do
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8372
  • View blog
  • Posts: 31,117
  • Joined: 12-June 08

Re: Saving datagridview row to access database with colour

Posted 29 May 2012 - 07:59 AM

Ah.. coloring the datasheet. I was understanding this as "I have an app with colored rows and I want to retain that coloring in the datastore". I keep forgetting people use Access for a bit more than just holding data for an app.
Was This Post Helpful? 0
  • +
  • -

#11 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Re: Saving datagridview row to access database with colour

Posted 29 May 2012 - 08:02 AM

no problem I thought that you didn't understand me. but i though it could have been just me being stupid lol.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1