hi
- public void Paint(PaintEventArgs e) //here e is showing null reference in class {"Object reference not set to an instance of an object."}//
- {
- //Graphics g = e.Graphics;
- e.Graphics.DrawRectangle(pen1, rect);
- }
how to avoid this I need to draw a rectangle by using class method but when I call paint method showing null reference exception.

Salman BegRank #284 · 8.8K reputationPosted Nov 26, 2020, 3:05 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Nov 26, 2020, 5:26 AM EST
S JRank #7,785 · 234 reputationPosted Nov 26, 2020, 6:55 PM EST
S JRank #7,785 · 234 reputationPosted Nov 26, 2020, 6:59 PM EST