4
4
4ex0V2012-11-09 07:06:26
Programming
4ex0V, 2012-11-09 07:06:26

A few questions about C#

Hello!

First question:

try
{
     // raiting
     allElementInformation[5, id] = ((HtmlNode)docHtml.DocumentNode.SelectSingleNode("//div[@class='d_text']/table[@class='d_table']/tr[5]/td")).InnerText;
}
catch
{
     errorUI.messageText(String.Format("Failed to retrieve data about the subject:\n {0}", allElementInformation[3, id]));
     errorUI.ShowDialog();
}


Actually, when the try block is null, the program should display the errorUI window and show on which element the error occurred. In Debug mode, everything works as it should, but in Release, the errorUI window is not displayed even once. What can be wrong?

Second question:


The upper part was removed in Windows7, the lower part in Windows 8. Is it possible to bring them to the same (preferably, as in Windows 8) form? Disabling InitializeComponent gives unacceptable appearance.

I ask for advice and help, because I know C # a little more than nothing.

Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pletinsky, 2012-11-09
@pletinsky

Regarding the second question , InitializeComponent is part of the job of initializing a window in WindowsForms . It cannot be disabled - otherwise the controls in the window will not be initialized.
It is not clear why you want to bring to one appearance. In two different windows completely different external styles. They are designed for the rest of the design of the operating system. Even if this can be done (although it is unlikely), this should not be done. It would not occur to you under Android to try to make exactly the same calendar. Get this heresy out of your head.

P
pletinsky, 2012-11-09
@pletinsky

All right. In the case of WinForms, we control the general layout of elements and their properties, but Windows itself draws the elements and we cannot control many things. And different windows can draw them differently.
An application tailored for Windows XP (classic style) will look ugly in Windows 7 with aero style. Similarly, Aero style (Windows 7) has nothing to do with Metro style (Windows 8). This is exactly what is cool that we do not have to explicitly sharpen each application for a specific yuan of the operating system.
WPF applications can also look different on different operating systems, but provide more styling control.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question