|
List<string> LobjFontList = new List<string>();InstalledFontCollection LobjFonts = new InstalledFontCollection();foreach (FontFamily LobjFamily in LobjFonts.Families){LobjFontList.Add(LobjFamily.Name);}
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
|
What's involved in reading and writing data to/from a mainframe in C#?
Everything Makes Sense In Someones Mind
|
|
|
|
|
Can you be more specific? There's a gazillion ways to read/write data from another computer.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The organization I work for has an app that's been around for many years and runs on an AS400. There has been talk of having me convert it to a WinForms app, so I was hoping to brush up on the data connection aspect of it.
I have no clue what's involved in accessing data on an AS400 from a WinForms app.
Everything Makes Sense In Someones Mind
|
|
|
|
|
This again totally depends on how the old app accessed the data. It might by anything, reading a file, connecting to a database, using some sort of RPC or IPC.
Maybe you can find some documentation for the old application that describes the data access in detail.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
If window is resized, listbox flashes.
how to remove flash during resize ?
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Drawing;
public class Test
{
static void Main()
{
Application.Run(new ReportDialogForm());
}
}
class ReportDialogForm : Form
{
public ReportDialogForm()
{
tabControl1 = new TabControl();
tabPage1 = new TabPage();
reportListBox = new ListBox();
tabControl1.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom)
| AnchorStyles.Left)
| AnchorStyles.Right)));
tabControl1.Controls.Add(tabPage1);
tabControl1.Location = new Point(0, 0);
tabControl1.Padding = new Point(0, 0);
tabControl1.SelectedIndex = 0;
tabControl1.Size = new Size(591, 296);
tabControl1.TabIndex = 0;
tabPage1.Controls.Add(reportListBox);
tabPage1.Location = new Point(4, 29);
tabPage1.Margin = new Padding(0);
tabPage1.Size = new Size(583, 263);
tabPage1.TabIndex = 0;
tabPage1.Layout += new LayoutEventHandler(tabPage1_Layout);
reportListBox.Anchor = AnchorStyles.None;
reportListBox.Size = new Size(287, 384);
reportListBox.TabIndex = 1000;
ClientSize = new Size(588, 292);
Controls.Add(tabControl1);
for (int i = 0; i < 100; i++)
reportListBox.Items.Add( "MMMMMMMMMMMMMMMMMMMMMM");
Load += new EventHandler(ReportDialogForm_Load);
}
void ReportDialogForm_Load(object sender, EventArgs e)
{
StartPosition = FormStartPosition.Manual;
Location = new Point(10, 10);
ClientSize = new Size(400, 400);
}
void tabPage1_Layout(object sender, LayoutEventArgs e)
{
SuspendLayout();
int height = 100;
reportListBox.Top = height;
reportListBox.Height = tabPage1.Height - height;
reportListBox.Width = tabPage1.Width / 2;
reportListBox.Left = 0;
ResumeLayout();
}
TabControl tabControl1;
TabPage tabPage1;
ListBox reportListBox;
}
Andrus
|
|
|
|
|
In the form's properties there's an option "DoubleBuffered" try setting it to true.
|
|
|
|
|
Thank you.
I added DoubleBuffered = true; as first line in constructor:
public ReportDialogForm()
{
DoubleBuffered = true;
...
However, listbox still blinks on resize.
Adding DoubleBuffered did not make any difference.
Andrus
|
|
|
|
|
Good people,
Over the next year or two, I will be building applications to perform specific tasks related to my job. However, I want these specific applications to end up comprising one application. So for example, when I finish the first app, I want to add the second app to it. This will enable me to have a very useful application that performs different but related tasks.
My question is, what strategy should I pursue to do this effectively. You see, while the tasks are different, they all are related to some type of data analysis and processing. That's why it would be great to have it as one application with components being added.
Let me know your thoughts.
Thanks in advance.
BP
|
|
|
|
|
|
I ma developing a C# application now that will have multiple sub-apps. I'm building them as seperate DLL's and loading them dynamically at startup. Maybe this would work for you?
Everything Makes Sense In Someones Mind
|
|
|
|
|
BlitzPackage wrote: Over the next year or two, I will be building applications to perform specific tasks related to my job
I guess this is gonna be a Windows App.
What I would suggest is try to break up the modules and make specific components for that.
It will help you in assembling your application and would also be easier to maintain the same in future.
|
|
|
|
|
Thanks.
It will actually be a WPF application.
Can I build it as a regular app then convert it to a DLL?
|
|
|
|
|
Essentially an EXE is just a DLL with a static main method; both contain an assembly.
The classes in the assembly (if public) can be accessed by classes in other assemblies.
|
|
|
|
|
I am trying to create a Log Console that will be a hidden form that will called up when LogConsole.Show() is issued, and write to the Data Grid that is not bound by using the methods as defined. I never done anything like that and I need direction.
Take a look at the code below to get a feel for what i am trying to do.
namespace System.Diagnostics
{
public class LogConsole
{
public static readonly LogConsole Instance = new LogConsole();
private LogConsoleWrapper LogConsoleForm = new LogConsoleWrapper();
public void Show()
{
LogConsoleForm.Show();
}
public void Hide()
{
LogConsoleForm.Hide();
}
public void Focus()
{
LogConsoleForm.Focus();
}
public void WriteLine(string message)
{
LogConsoleForm.Write(message);
}
public void WriteLine(string message, bool error)
{
LogConsoleForm.Write(message, error);
}
public void WriteLine(string message, Exception ex)
{
LogConsoleForm.Write(message, (Exception)ex);
}
}
public class LogConsoleWrapper : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
static string sSource = "PIMSLite2008 Log Console";
static string sLog = "Application";
public LogConsoleWrapper()
{
InitializeComponent();
if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource, sLog);
clock.Start();
lblUser.Text = System.Environment.UserName.ToString().ToUpper();
}
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region User Defined Code
private void clock_Tick(object sender, EventArgs e)
{
lblDate.Text = DateTime.Now.ToShortDateString();
lblTime.Text = DateTime.Now.ToLongTimeString();
}
public void Write(string message)
{
string[] tmp = new string[3];
tmp[0] = DateTime.Now.ToLongTimeString() + " " + DateTime.Now.ToShortDateString();
tmp[1] = "N/A";
tmp[2] = message;
dgLog.Rows.Add(tmp);
}
public void Write(string message, bool error)
{
string[] tmp = new string[3];
tmp[0] = DateTime.Now.ToLongTimeString() + " " + DateTime.Now.ToShortDateString();
if (error == true)
{
tmp[1] = "Error";
}
else
{
tmp[1] = "Information";
}
tmp[2] = message;
dgLog.Rows.Add(tmp);
}
public void Write(string message, Exception ex)
{
string[] tmp = new string[3];
tmp[0] = DateTime.Now.ToLongTimeString() + " " + DateTime.Now.ToShortDateString();
tmp[1] = "Error";
tmp[2] = message;
dgLog.Rows.Add(tmp);
string errorMessage = "USER: " + System.Environment.UserName + "\r\n" + new String('-', 100) + "\r\nFUNCTION: " + System.Reflection.MethodBase.GetCurrentMethod().ToString() + "\r\n" + new String('-', 100) + "\r\nSOURCE: \r\n" + ex.Source + "\r\n" + new String('-', 100) + "\r\nMESSAGE: \r\n" + ex.Message + "\r\n" + new String('-', 100) + "\r\nCUSTOM MESSAGE:\r\n" + message + "\r\n" + new String('-', 100) + "\r\nSTACK TRACE: \r\n" + ex.StackTrace;
EventLog.WriteEntry(sSource, errorMessage, System.Diagnostics.EventLogEntryType.Error);
}
#endregion
|
|
|
|
|
I would try to declare it as a member of the Application class. Then, you can refer to it by accessing the application object. I believe you can get access to the application object anywhere in your code. I hope that helps.
|
|
|
|
|
I'm unclear as to what the problem is.
Public classes are available "throughout an entire project/application".
Is there a more specific problem you're encountering?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark brings up a good point. However, I think he needs a place to put an instantiated object of that class.
I know in WPF Applications there is a App.xaml.cs file that gives you access to the application object. However, I am not sure where to find the App.cs file in Windows Forms applications.
|
|
|
|
|
I'm still unclear how the OP title relates to the code
(mostly because my attention span won't let me read a code snippet
that big ), but the
public static readonly LogConsole Instance = new LogConsole();
makes "Instance" globally available since the LogConsole class is public.
I'm not sure what's not working
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Good point. Where would he declare it?
|
|
|
|
|
I copied that from the 5th line of his code
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
What is the difference between Excel2003 Addin and Excel2003 Workbook project in c#2008 ??????????
|
|
|
|
|
An Add-in provide more features or services to an application. So, basically an Excel Add-in will add more feature to our existing MS Excel Application.for eg: you may want to create and add-in which will post data to your web server.(this is just a crude example)
While a Excel project is nothing but creating a workbook through Visual Studio.
|
|
|
|
|
So, i want to develop my own toolbar which should get installed in excel 2003 and also i can distribute to any other machines, so which approach is better for that workbook or addin.
|
|
|
|