NullReference在表单加载时更改DGV中行的颜色时出现异常

时间:2017-08-30 19:44:28

标签: c# datagridview

在我在datagridview中加载数据后的表单加载事件之后,我调用此函数来更改付费开销为是的那些行的颜色但它在行上给出了null引用异常

PaidStatus = ExpensesDataGridView.Rows [i] .Cells [4] .Value.ToString();

case

1 个答案:

答案 0 :(得分:0)

Cells start from a 0th index, meaning that the 4th cell would be at import matplotlib.pyplot as plt import plotly.plotly as py import pandas as pd import plotly.graph_objs as go # read in LEC LLEC = pd.read_csv('LLEC_1.csv').transpose() RLEC = pd.read_csv('RLEC_2.csv').transpose() #read in DGCA3 LDGCA3=pd.read_csv('LDGCA3_13.csv').transpose() RDGCA3 = pd.read_csv('RDGCA3_14.csv').transpose() def plot_betas_left(betaNum): betaNum = int(betaNum) #plot betas for both ROIs. start with LEC ax = LLEC[betaNum].plot() # add DGCA3 LDGCA3[betaNum].plot(ax=ax) # label axes ax.set_xlabel("precise beta number (0 is first)") ax.set_ylabel("beta coefficient value") # inset legend ax.legend(['LEC', 'DGCA3']) plt.savefig('Subj%s_left_LEC_DGCA3.png' % betaNum+1) plot_betas(3) index . In the same way, the row and column indices start from 0 as well but your loop starts from an python get-pip.py so I suggest you change that as well to: get-pip.py

Or use [3] :

int i = 1