Forum Widgets
Latest Discussions
_EnumDesktopWindows API problem
_EnumDesktopWindows API which uses User32.dll stopped working when the patch having OS build number 26100.3775 was updated on Windows 11. The version which was thus installed for Windows 11 is 24H2. It happen also on windows 2019 server having 24H2 as version number. When it tries to get a windows handle of a FORM, it freezes and doesn't allow the user to do anything. What seems to be the problem & how this can be rectified? Anyone's help will be deeply appreciated. Thanks...TANMOY1975May 08, 2025Copper Contributor52Views0likes0CommentsSpecify locale/language for exception messages to user during runtime.
I am using VB 2022 with .NET 8 & 9. I develop applications that allow the user to specify which language they want the GUI elements to be displayed in while the application is running - regardless of what language the users' MS Windows profile is set to. The reason I do this is because some companies (mine included) require all systems to be set to the U.S. English (EN-US) regional/locale settings. This is very easy for me to achieve, even for expected user errors which I can head off. However, unexpected system error messages are always displayed in the English language because the system is set to the English language. Is there any known way to force unexpected error/exception messages to be displayed in a language other than the system's current language? If I knew every single possible error that could be thrown up, as well as its corresponding error code/number, I could create translations myself. But, unfortunately, I have no way of listing every possible system error that could be thrown up during runtime. It would be nice if Microsoft had a COMPLETE list of these somewhere. But every list I've seen is fragmented and incomplete, and sometimes doesn't include a corresponding error code with the message. Try 'Attempt the following block of code. '/////////////////////////////////////////////// ' E X E C U T E S O M E C O D E H E R E ! '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Catch e As System.Exception 'Trap any unexpected system error. MessageBox.Show(e.HResult.ToString & NewLine & e.Message, MyCaption, MessageBoxButtons.OK, MessageBoxIcon.Error) 'Display the error message to the user. End Try Even though the user's system is set to the English language, I want to be able to display the message passed in the 'e.Message' member from the codes sample in whatever language the user has specified their GUI to display in during that application's runtime. Any ideas how to achieve this? BTW... the ability to do this would be an AWESOME feature for Microsoft to add to future .NET releases.GypsyPrinceFeb 23, 2025Copper Contributor122Views0likes0CommentsC# JSON deserialization returns null
Hi there, so first of, I just started working with JSON deserialization today and just know the bare basics. Basically I am currently developing a bot wich should get data from an API of a minecraft server. So far everything works perfectly except one thing: Since a minecraft uuid can start with a number (like for example "121e2d73913041ffaa49af39d124673f") visual studio automatically creates the uuid part with "_" ("public _121E2d73913041ffaa49af39d124673f _121e2d73913041ffaa49af39d124673f { get; set; }"). Now, when I try to request data from a uuid wich starts with a letter everything works fine. However when I request it from a uuid with a number, it will return null. My guess is, that since the JSON itself does not have "_", it wont get deserialized into the in-code version with "_". -> btw, I am using System.Text.Json, not Newtonsoft.Json but would have no problems changing... I hope. So, my question is, if there is a way to get this to work or maby work arround it? Thanks in advance :DDefinitivVair0Jan 05, 2025Copper Contributor130Views0likes0CommentsExtract images from excel stored as Place in cell
Hello experts, I am trying to extract images from an Excel file using a C# program. My code successfully retrieves images that are placed over cells in the worksheet. Now, I need to adapt this functionality so that it can retrieve images which are stored as Place in cell in the excel .I want use this Azure Function for Business Central integration here is the code using Openize.Cells; using System.IO; using DocumentFormat.OpenXml; class Program { static void Main(string[] args) { string filePath = "C:\\Users\\Raj.Kamal\\Downloads\\test.xlsx"; // The path to your workbook string outputDirectory = "C:\\Users\\Raj.Kamal\\Downloads"; // Load the workbook from the specified file path Workbook wb = new Workbook(filePath); // Select the first worksheet from the workbook var worksheet = wb.Worksheets[0]; // Extract images from the worksheet var images = worksheet.ExtractImages(); // Check if the output directory exists; if not, create it if (!Directory.Exists(outputDirectory)) { Directory.CreateDirectory(outputDirectory); } // Loop through each extracted image foreach (var image in images) { // Construct a unique file path for the image using a GUID var outputFilePath = Path.Combine(outputDirectory, $"Image_{Guid.NewGuid()}.{image.Extension}"); // Save the image data to the constructed file path using (var fileStream = File.Create(outputFilePath)) { image.Data.CopyTo(fileStream); } } } } Any code snippets, documentation links, or best practices would be greatly appreciated. Excel file:RajKamalDec 09, 2024Copper Contributor280Views0likes0CommentsEnhancing Console.ReadLine to Accept a Message Parameter
n Python, the input function allows you to display a message and wait for user input in a single line of code. However, in C#, achieving the same functionality requires two lines: one for Console.WriteLine to display the message and another for Console.ReadLine to capture the input. Is it possible to have a ReadLine function in C# that takes a message as a parameter and waits for user input?PaulinusWongDec 01, 2024Copper Contributor53Views0likes0CommentsPregunta PdfViewer
Hola a todos Estoy trabajando con PdfViewer de Patagames para visualizar PDFs en un formulario WindowsForm. Tengo dos botones, uno para ajustar al ancho de página y otro para mostrar toda la página, pero no consigo implementar el código. ¿Podrían ayudarme? Gracias de antemano.JDamianOlivaNov 19, 2024Copper Contributor49Views0likes0CommentsPossible to change method called inside foreach?
I have a created a function as below public static ICustomers[]? SanitiseCustomers(this string[]? custVals, float boxed = 0.5f) { List<ICustomers> customers = []; foreach (var c in custVals) { customers.Add(c.Sanitize(boxed)); } return [.. customers]; } I want to replace the Sanitize function within the foreach loop to a different method. I dont want to copy and paste the function and create a new one and changing Sanitize to FriendlyBox but trying to see if there is a way to switch the method name depending on the way this function is called?Pattison159Sep 24, 2024Copper Contributor194Views0likes0Comments- jaffarm183Sep 12, 2024Copper Contributor192Views0likes0Comments
cannot plot vertical aligned column range in chart.net
Hi I need to plot 10 column range vertical aligned. With this code I have compensate disalignment BUT after 4 plot it become again disaligned: Me.Invoke(Sub() Chart.Series("FOOT").Points.AddXY(Indice_Corrente, Dato_Base_FOOT, Dato_Plot_FOOT) Chart.Series("SX_UP").Points.AddXY(Indice_Corrente - 0.65, Dato_Base_SX_UP, Dato_Plot_SX_UP) Chart.Series("SX_DOWN").Points.AddXY(Indice_Corrente - 1.3, Dato_Base_SX_DOWN, Dato_Plot_SX_DOWN) End Sub) Why????????Giuseppe_PezzellaJul 15, 2024Copper Contributor183Views0likes0CommentsNeed help to display DataTable data on C# form
I have 2 instances running, one is the application and another one is running as server. I have a log form to show some records added on the DataTable as log information. Data row added during server runtime is not showing on the client instance form when click to open the form. I'm not familiar with C#, please share some ideas how can I achieve this, thanks.JohnLohJun 17, 2024Copper Contributor221Views0likes0Comments