Click here to Skip to main content
15,912,932 members

Comments by xirokx (Top 14 by date)

xirokx 25-Jul-14 20:55pm View    
Deleted
thanks for your reply

regretably your solution permanently fixed the background colour as per the colour specified.

the way it works is:

- create a folder in res called drawable
- place a file called hover.xml inside that folder
- set the onstate, selected and other properties to a colour of your choice
- link to this folder in your activity_main file i.e. android: list_selector ="drawable/hover"

and it works a treat :-)

thanks for your response
xirokx 23-Jul-14 16:44pm View    
thanks

list.setOnItemClickListener(new OnItemClickListener(){

public void onItemClick(AdapterView<!--?--> parent, View view, int position, long id){


view.setBackgroundColor(Color.CYAN);


}

});


thats my code

when I click, the list item background color changes to CYAN

however the list item remains as CYAN after my click and I just want it to show CYAN on click and its default colour which is black when its not being clicked.

Basically, I am trying to implement a rollover on a list item, on click change color to cyan then change to default color.

any ideas how i can acheive this?

thank
xirokx 22-Jul-14 5:11am View    
Ahh, to solve this I went into Form1.Designer.cs file and removed the line:

this.dataGridView1.RowsAdded += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.dataGridView1_RowsAdded);

I then added the same line to my Form1.cs file, which checks for new records NOT when the form loads but every 4-5minutes afterwards and alerts user if new records have been added.

Thanks for your help, really appreciate it.
xirokx 22-Jul-14 3:45am View    
public partial class Form1 : Form
{
Timer timer = new Timer();


public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
this.CarUpdateTableAdapter.Fill(this._SAC_OTPDataSet.CarUpdate);

this.dataGridView1.Sort(this.dataGridView1.Columns[18], ListSortDirection.Descending);
dataGridView1.AutoResizeColumns();


timer.Interval = 60000;
timer.Tick += new EventHandler(UpdateDataGridView);
timer.Start();
}



private void UpdateDataGridView(object sender, EventArgs e)
{



this.CarUpdateTableAdapter.Fill(this._SAC_OTPDataSet.CarUpdate);


}

private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
{
MessageBox.Show("New Cars Added:");
}

}

okay so my code looks like this....

On Form Load the messageBox is first shown 4-5 times, even if its not adding new records so I keep pressing accept to see datagridview. This is not how it should work.

My aim is for a messageBox to be displayed ONLY when the datagridview is refreshed as the database it gets its values from is updated every 5-6mins and sometimes there is new data and sometimes not. In the event there is new data I would like a messagebox to show up.

Please can you correct my code to enable this to happen?

Thanks in advance
xirokx 21-Jul-14 9:06am View    
thanks for your response,

where in my code do I place your method?

surely I have to check first if rows are being added and only call your method if new rows are being added?

pls clarify

thanks