Click here to Skip to main content
15,894,106 members
Home / Discussions / C#
   

C#

 
AnswerRe: Just a thought...why is my application taking so much RAM? Pin
Scott Dorman18-Feb-07 13:53
professionalScott Dorman18-Feb-07 13:53 
QuestionDataBind error with Gridview Pin
BMWABCD18-Feb-07 7:36
BMWABCD18-Feb-07 7:36 
AnswerRe: DataBind error with Gridview Pin
Stefan Troschuetz18-Feb-07 8:05
Stefan Troschuetz18-Feb-07 8:05 
QuestionWebClient DownloadProgressChangedEventHandler not working!! Pin
Rizawn18-Feb-07 6:19
Rizawn18-Feb-07 6:19 
AnswerRe: WebClient DownloadProgressChangedEventHandler not working!! Pin
Stefan Troschuetz18-Feb-07 6:34
Stefan Troschuetz18-Feb-07 6:34 
GeneralRe: WebClient DownloadProgressChangedEventHandler not working!! Pin
Rizawn18-Feb-07 6:41
Rizawn18-Feb-07 6:41 
QuestionHow to set values of two properties in other method Pin
AndrusM18-Feb-07 5:13
AndrusM18-Feb-07 5:13 
AnswerRe: How to set values of two properties in other method Pin
Stefan Troschuetz18-Feb-07 6:55
Stefan Troschuetz18-Feb-07 6:55 
AndrusM wrote:
it seems that parameters are passed by value.


Not generally true. Value types are passed by value and reference types are passed by reference.
If for example you have a int parameter, any changes to this parameter won't reflect outside the method.
If on the other hand the int is a field of some class assumably called IntHolder and a method has a parameter of this class, changes to the int field of an instance of the IntHolder class will reflect outside the method, because the object is passed by reference and the parameter points to the same object as a variable outside the method.
What will not reflect outside the method is the assignment of a new instance of the IntHolder class to the parameter. To circumvent the latter restriction and those mentioned for the value types, you can declare a parameter as ref or out. In short you could say that they cause a value type to be passed by reference and in case of a reference type imagine the reference to be passed by reference. For more information on the both keywords take a look at the docs.
In your specific case, I think the easiest would be passing the DataGridTableStyle instance to the GetColors method (is passed by reference) and assign the colors retrieved from the database to the corresponding properties.
public void GetColors(DataGridTableStyle tableStyle) 
{
  IDataReader tableReader = ExecReader("SELECT hforecol,hbackcol FROM desktop");
  if (tableReader.Read()) 
  {	
    tableStyle.HeaderForeColor = GetColor(tableReader.GetDecimal(0));	
    tableStyle.HeaderBackColor = GetColor(tableReader.GetDecimal(1));	
  }
  tableReader.Close();
}




"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

www.troschuetz.de

GeneralRe: How to set values of two properties in other method Pin
AndrusM18-Feb-07 12:19
AndrusM18-Feb-07 12:19 
GeneralRe: How to set values of two properties in other method Pin
Stefan Troschuetz18-Feb-07 21:59
Stefan Troschuetz18-Feb-07 21:59 
QuestionSnippet Manager Pin
marvviki18-Feb-07 3:02
marvviki18-Feb-07 3:02 
AnswerRe: Listview with images? Pin
Adi Khan 7918-Feb-07 4:43
Adi Khan 7918-Feb-07 4:43 
Questionprotected and protected internal Pin
amaneet18-Feb-07 1:11
amaneet18-Feb-07 1:11 
AnswerRe: protected and protected internal Pin
Marc Clifton18-Feb-07 3:30
mvaMarc Clifton18-Feb-07 3:30 
Questionhow change input language Pin
Iman Mohsen18-Feb-07 1:07
Iman Mohsen18-Feb-07 1:07 
AnswerRe: how change input language Pin
sharpiesharpie18-Feb-07 1:55
sharpiesharpie18-Feb-07 1:55 
QuestionButton context menu Pin
CodeItWell18-Feb-07 0:50
CodeItWell18-Feb-07 0:50 
AnswerRe: Button context menu Pin
Christian Graus18-Feb-07 10:00
protectorChristian Graus18-Feb-07 10:00 
QuestionFOR Statement Pin
Glen Harvy18-Feb-07 0:37
Glen Harvy18-Feb-07 0:37 
AnswerRe: FOR Statement Pin
mnvkng7618-Feb-07 0:52
mnvkng7618-Feb-07 0:52 
GeneralRe: FOR Statement Pin
Glen Harvy18-Feb-07 1:20
Glen Harvy18-Feb-07 1:20 
GeneralRe: FOR Statement Pin
mnvkng7618-Feb-07 2:05
mnvkng7618-Feb-07 2:05 
AnswerRe: FOR Statement Pin
Guffa18-Feb-07 1:42
Guffa18-Feb-07 1:42 
GeneralRe: FOR Statement Pin
Glen Harvy18-Feb-07 1:47
Glen Harvy18-Feb-07 1:47 
AnswerRe: FOR Statement Pin
Christian Graus18-Feb-07 9:21
protectorChristian Graus18-Feb-07 9:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.