Click here to Skip to main content
15,885,856 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cannot Access the form _ Cross-thread operation Pin
mohammadkaab21-Jan-13 20:26
mohammadkaab21-Jan-13 20:26 
Questionwcf p2p file transfering over internet Pin
vab26108519-Jan-13 2:03
vab26108519-Jan-13 2:03 
QuestionWorking with tab escape charecter Pin
Mc_Topaz19-Jan-13 1:49
Mc_Topaz19-Jan-13 1:49 
AnswerRe: Working with tab escape charecter Pin
Abhinav S19-Jan-13 2:38
Abhinav S19-Jan-13 2:38 
GeneralRe: Working with tab escape charecter Pin
Mc_Topaz19-Jan-13 3:22
Mc_Topaz19-Jan-13 3:22 
QuestionDesign-Time Error in the Windows Forms Designer Pin
_Q12_18-Jan-13 4:25
_Q12_18-Jan-13 4:25 
AnswerRe: Design-Time Error in the Windows Forms Designer Pin
Eddy Vluggen18-Jan-13 5:02
professionalEddy Vluggen18-Jan-13 5:02 
AnswerRe: Design-Time Error in the Windows Forms Designer Pin
Alan N18-Jan-13 5:42
Alan N18-Jan-13 5:42 
It's because the StartupPath is not what you think it is. Testing this on my system causes the designer view of the form to show an error message in HTML, helpfully rendered as one very long line. Carefully scrolling through it reveals that it looking for the image
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\pic.jpg

In a simplified test I place the image directly onto an otherwise empty user control. I thought that the correct thing to do would be to stop the designer attempting to load the image like this:
C#
public partial class ImageControl : UserControl {
  String path;
  public ImageControl() {
    InitializeComponent();
    path = Application.StartupPath;
  }

  private void ImageControl_Load(object sender, EventArgs e) {
    if (!DesignMode) {
      BackgroundImage = Bitmap.FromFile(Path.Combine(path, "pic.jpg"));
    }
  }
}


Job done you might think, but no, as this allows the form to render properly with the image displayed. So what is going on? Actually I don't know, but the only reasonable explanation is that the designer loads the form more than once, in DesignMode where the path is incorrect and at least once more, not in DesignMode, where the path is correct.
QuestionParalel QuickSort with 2 threads running at the same spped Pin
George Nistor18-Jan-13 0:51
George Nistor18-Jan-13 0:51 
AnswerRe: Paralel QuickSort with 2 threads running at the same spped Pin
Dave Kreskowiak18-Jan-13 4:20
mveDave Kreskowiak18-Jan-13 4:20 
GeneralRe: Paralel QuickSort with 2 threads running at the same spped Pin
George Nistor18-Jan-13 4:41
George Nistor18-Jan-13 4:41 
GeneralRe: Paralel QuickSort with 2 threads running at the same spped Pin
Dave Kreskowiak18-Jan-13 6:25
mveDave Kreskowiak18-Jan-13 6:25 
AnswerRe: Paralel QuickSort with 2 threads running at the same spped Pin
Alan Balkany18-Jan-13 5:12
Alan Balkany18-Jan-13 5:12 
GeneralRe: Paralel QuickSort with 2 threads running at the same spped Pin
George Nistor18-Jan-13 5:31
George Nistor18-Jan-13 5:31 
GeneralRe: Paralel QuickSort with 2 threads running at the same spped Pin
Dave Kreskowiak18-Jan-13 6:26
mveDave Kreskowiak18-Jan-13 6:26 
GeneralRe: Paralel QuickSort with 2 threads running at the same spped Pin
George Nistor18-Jan-13 6:53
George Nistor18-Jan-13 6:53 
GeneralRe: Paralel QuickSort with 2 threads running at the same spped Pin
Dave Kreskowiak18-Jan-13 7:31
mveDave Kreskowiak18-Jan-13 7:31 
GeneralRe: Paralel QuickSort with 2 threads running at the same spped Pin
George Nistor18-Jan-13 7:38
George Nistor18-Jan-13 7:38 
GeneralRe: Paralel QuickSort with 2 threads running at the same spped Pin
George Nistor18-Jan-13 22:49
George Nistor18-Jan-13 22:49 
GeneralRe: Paralel QuickSort with 2 threads running at the same spped Pin
Dave Kreskowiak19-Jan-13 3:27
mveDave Kreskowiak19-Jan-13 3:27 
QuestionDataSet to Dictionary Join? Pin
RickSharp17-Jan-13 12:25
RickSharp17-Jan-13 12:25 
GeneralRe: DataSet to Dictionary Join? Pin
PIEBALDconsult17-Jan-13 12:34
mvePIEBALDconsult17-Jan-13 12:34 
GeneralRe: DataSet to Dictionary Join? Pin
RickSharp17-Jan-13 12:51
RickSharp17-Jan-13 12:51 
GeneralRe: DataSet to Dictionary Join? Pin
PIEBALDconsult17-Jan-13 13:03
mvePIEBALDconsult17-Jan-13 13:03 
GeneralRe: DataSet to Dictionary Join? Pin
RickSharp17-Jan-13 13:13
RickSharp17-Jan-13 13:13 

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.