Click here to Skip to main content
15,919,749 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# to Excel Pin
aaraaayen20-Jul-06 23:49
aaraaayen20-Jul-06 23:49 
GeneralRe: C# to Excel Pin
Nader Elshehabi21-Jul-06 3:26
Nader Elshehabi21-Jul-06 3:26 
AnswerRe: C# to Excel Pin
stancrm21-Jul-06 1:38
stancrm21-Jul-06 1:38 
QuestionIn C# ,How can i use a C++ DLL with a class being defined in head file. Pin
dfbx20-Jul-06 17:43
dfbx20-Jul-06 17:43 
AnswerRe: In C# ,How can i use a C++ DLL with a class being defined in head file. Pin
Andrei Ungureanu20-Jul-06 19:47
Andrei Ungureanu20-Jul-06 19:47 
GeneralRe: In C# ,How can i use a C++ DLL with a class being defined in head file. Pin
dfbx20-Jul-06 20:37
dfbx20-Jul-06 20:37 
AnswerRe: In C# ,How can i use a C++ DLL with a class being defined in head file. Pin
Andrei Ungureanu20-Jul-06 22:35
Andrei Ungureanu20-Jul-06 22:35 
GeneralRe: In C# ,How can i use a C++ DLL with a class being defined in head file. Pin
dfbx23-Jul-06 16:21
dfbx23-Jul-06 16:21 
QuestionHow to support right-click *on* WinForms context menu items? Pin
cpeterso20-Jul-06 15:07
cpeterso20-Jul-06 15:07 
AnswerRe: How to support right-click *on* WinForms context menu items? Pin
Judah Gabriel Himango20-Jul-06 16:12
sponsorJudah Gabriel Himango20-Jul-06 16:12 
AnswerRe: How to support right-click *on* WinForms context menu items? Pin
Nader Elshehabi20-Jul-06 22:40
Nader Elshehabi20-Jul-06 22:40 
QuestionMy ASP.NET 2.0 Web Pages do not run inside IIS Pin
tedhill1320-Jul-06 14:17
tedhill1320-Jul-06 14:17 
AnswerRe: My ASP.NET 2.0 Web Pages do not run inside IIS Pin
Andrei Ungureanu20-Jul-06 19:52
Andrei Ungureanu20-Jul-06 19:52 
GeneralRe: My ASP.NET 2.0 Web Pages do not run inside IIS Pin
tedhill1323-Jul-06 9:23
tedhill1323-Jul-06 9:23 
QuestionPictureBox in mdi form Pin
Saamir20-Jul-06 11:32
Saamir20-Jul-06 11:32 
AnswerRe: PictureBox in mdi form Pin
Ed.Poore20-Jul-06 12:50
Ed.Poore20-Jul-06 12:50 
QuestionRe: PictureBox in mdi form Pin
Saamir20-Jul-06 16:45
Saamir20-Jul-06 16:45 
AnswerRe: PictureBox in mdi form Pin
Ed.Poore20-Jul-06 21:07
Ed.Poore20-Jul-06 21:07 
Question.insert is inserting 2 entries instead of one... please help. Pin
jaman4dbz20-Jul-06 11:02
jaman4dbz20-Jul-06 11:02 
AnswerRe: .insert is inserting 2 entries instead of one... please help. Pin
Ed.Poore20-Jul-06 12:48
Ed.Poore20-Jul-06 12:48 
AnswerRe: .insert is inserting 2 entries instead of one... please help. Pin
Alexander Wiseman20-Jul-06 13:33
Alexander Wiseman20-Jul-06 13:33 
One thing I notice about your function is this line:
TabPage newtabpage = blanktabpage
Where is blanktabpage initialized and created? The question is important because I think your code is not actually creating a new TabPage every time the function is called. The reason for this is that class types are reference types, which means that unless you actually have the new keyword in there, you are not creating another instance of the class in memory. I'm not completely sure I have this down properly (I may have been wrong in my explanation), but have a look at this article by Jon Skeet[^] on the distinction between reference types and value types.

What this means (I think) for your code is that newtabpage refers to an already existing TabPage in memory. Changes that you are making with the variable newtabpage are affecting what blanktabpage points to. I'm not sure that this will necessarily produce the effect you are describing, but it is a problem.

Try this instead: at the beginning of your addatab function, use the new keyword instead, like this:
TabPage newtabpage = new TabPage()
Then set the properties of the tab page based on the properties of blanktabpage and see what happens when you call Add or Insert.

I'm fairly sure what I have said in this post is correct concerning reference types, but if I am wrong, I would welcome a correction from anyone who knows better.

Sincerely,
Alexander Wiseman
AnswerRe: .insert is inserting 2 entries instead of one... please help. Pin
jaman4dbz20-Jul-06 14:09
jaman4dbz20-Jul-06 14:09 
GeneralRe: .insert is inserting 2 entries instead of one... please help. Pin
Alexander Wiseman20-Jul-06 14:26
Alexander Wiseman20-Jul-06 14:26 
GeneralRe: .insert is inserting 2 entries instead of one... please help. Pin
jaman4dbz21-Jul-06 6:21
jaman4dbz21-Jul-06 6:21 
QuestionSecurity Permissions Pin
JuanAlbertoMD20-Jul-06 10:21
JuanAlbertoMD20-Jul-06 10: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.