|
Dear Kaafb,
Thanks for ur reply,
I have one Table name Element.In this I want to insert 32Rows with 6 coloumns.For that I am using Textboxes.
|
|
|
|
|
|
The last time I looked, 32 * 6 wasn't 150. Why 150 textboxes (we ask again)?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
yah it's32*6=192 Text Boxes
|
|
|
|
|
This is far too many for the user to comprehend or fill in reliably in one go.
At the very least I suggest you create a wizard to enter each row at a time and ensure they add 32 rows somehow. Better yet, it sounds like an interface re-design might be appropiate.
|
|
|
|
|
As keefb says, that is way too many. Plus, what happens when suddenly you need to up it from 32 to 40 rows? Or add another column? Just what are you going to call these textboxes, that makes it easy to work out what is going on?
Think again. When did you see a database example that used textboxes for each row? What do database examples use?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Total of 720 controls on the page, and I need the same functionality
|
|
|
|
|
Hi there,
I use a custom progressbar with text in a custom control and I update the text with a timer.The text is shown and everything works but the text over the progressbar mess up instead of being updated.When I minimize the main form and maximize it back, it updates. All of my attempts(using update(),refresh() and invalidate()) are useless.Could you please tell me what I should do?
note: I use the same control on another form but this time not in a custom control and it works like a charm
|
|
|
|
|
Is it possible to post some of the code?
Regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
//this code is in a custom control's class and the custom control is in main form
DateTime dt_starttime; //this takes the start time from a button on mainform when clicked
TimeSpan ts_elapsed;
public void tmrSure_Tick(object sender, EventArgs e) //this is triggered from the main form
{
// taking the elapsed time
DateTime dt_now = DateTime.Now;
ts_elapsed = dt_now.Subtract(dt_starttime);
theBestProgressBarEver1.CenterText = string.Format("{0:00}:{1:00}", ts_elapsed.Hours, ts_elapsed.Minutes); //CenterText is to show text
}
//normally the code is spreaded,I collected the pieces together to be able to post
thanks for your interest
|
|
|
|
|
|
thanks Programm3r
I solved the issue by putting ProgressBar.Refresh() on top in the timer event before the text property of the progressbar gets changed. But before, I had put it in the bottom of timer and didn't work. Anyway, thanks for dealing.
|
|
|
|
|
I want to Serialize a Dictionary in Binary format but I get an error message telling that this objecto is not Serializable, is there any way of do it or I need to create my own dictionary class.
Regards
|
|
|
|
|
There is an article here on CP about serializing Dictionaries (amongst other things). Unfortunately, for you, it uses XML Serialization. In case it may offer you some clues, here is a link Yet Another XML Serialization Library for the .NET Framework[^]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi all,
I found the following code, that allows one to write a string on a ProgressBar ... Only thing is that I can't get it to work Can anyone else make it work, and if so ... what am I doing wrong?
SetProgressBarText(progressBar1, null, ProgressBarTextLocation.Centered, Color.Black, SystemFonts.DefaultFont);
private void SetProgressBarText(System.Windows.Forms.ProgressBar Target,
string Text,
ProgressBarTextLocation Location,
System.Drawing.Color TextColor,
System.Drawing.Font TextFont
)
{
if (Target == null)
throw new ArgumentException("Null Target");
if (string.IsNullOrEmpty(Text))
{
int percent = (int)(((double)(Target.Value - Target.Minimum) / (double)(Target.Maximum - Target.Minimum)) * 100);
Text = percent.ToString() + "%";
}
using (Graphics gr = Target.CreateGraphics())
{
gr.DrawString(Text,
TextFont,
new SolidBrush(TextColor),
new PointF(
Location == ProgressBarTextLocation.Left ? 5 :
progressBar1.Width / 2 - (gr.MeasureString(Text,
TextFont).Width / 2.0F),
progressBar1.Height / 2 - (gr.MeasureString(Text,
TextFont).Height / 2.0F)));
}
}
public enum ProgressBarTextLocation
{
Left,
Centered
}
Many thanks in advance
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
|
public class ProgressLabel: ProgressBar {
private static StringFormat sfCenter = new StringFormat() {
Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center };
private Color textColor = DefaultTextColor;
private string progressString;
public ProgressLabel() { SetStyle(ControlStyles.AllPaintingInWmPaint, true); }
protected override void OnCreateControl() {
progressString = null;
base.OnCreateControl();
}
protected override void WndProc(ref Message m) {
switch(m.Msg) {
case 15: if(HideBar) base.WndProc(ref m);
else {
ProgressBarStyle style = Style;
if(progressString == null) {
progressString = Text;
if(!HideBar && style != ProgressBarStyle.Marquee) {
int range = Maximum-Minimum;
int value = Value;
if(range > 42949672) { value = (int)((uint)value>>7); range = (int)((uint)range>>7); }
if(range > 0) progressString = string.Format(progressString.Length == 0 ? "{0}%" : "{1}: {0}%",
value*100/range, progressString);
}
}
if(progressString.Length == 0) base.WndProc(ref m);
else using(Graphics g = CreateGraphics()) {
base.WndProc(ref m);
OnPaint(new PaintEventArgs(g, ClientRectangle));
}
}
break;
case 0x402: goto case 0x406;
case 0x406: progressString = null;
base.WndProc(ref m);
break;
default:
base.WndProc(ref m);
break;
}
}
protected override void OnPaint(PaintEventArgs e) {
Rectangle cr = ClientRectangle;
RectangleF crF = new RectangleF(cr.Left, cr.Top, cr.Width, cr.Height);
using(Brush br = new SolidBrush(TextColor))
e.Graphics.DrawString(progressString, Font, br, crF, sfCenter);
base.OnPaint(e);
}
public bool HideBar {
get { return GetStyle(ControlStyles.UserPaint); }
set { if(HideBar != value) { SetStyle(ControlStyles.UserPaint, value); Refresh(); } }
}
public static Color DefaultTextColor {
get { return SystemColors.ControlText; }
}
public Color TextColor {
get { return textColor; }
set { textColor = value; }
}
public override string Text {
get { return base.Text; }
set { if(value != Text) { base.Text = value; progressString = null; } }
}
public override Font Font {
get { return base.Font; }
set { base.Font = value; }
}
}
|
|
|
|
|
Thanks firda, been looking for that code all over.
|
|
|
|
|
how to use the same macro of excel in c#
Private Sub Worksheet_Activate()
Range("A1").Select
End Sub
|
|
|
|
|
|
the problem is im having a xls file and im opening it using workbook.open() and i select cell A10 and close it next time when i open the file i want the focus back on A1. i.e always the file is open the focus should be on cell A1 for that i used the macro which i stated in the previos thread. but i feel it would be better if i can do that also in the application.
below is the code
private void button1_Click(object sender, EventArgs e)
{
openexcel();
}
private static void openexcel()
{
Excel.Application xlApplication = new Excel.Application();
Excel.Workbooks xlBooks;
Excel.Worksheet xls;
xlBooks = xlApplication.Workbooks;
xlBooks.Open(Application.StartupPath + @"\ExcelFile01.xls", Type.Missing, false, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing);
xls = xlApplication.ActiveWorkbook.Worksheets[2] as Excel.Worksheet;
xls.Visible = Excel.XlSheetVisibility.xlSheetHidden;
xls = xlApplication.ActiveWorkbook.ActiveSheet as Excel.Worksheet;
xls.Rows.AutoFit();
//todo
focus back to cell A1
xlApplication.Visible = true;
System.Runtime.InteropServices.Marshal.ReleaseComObject(xls);
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBooks);
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApplication);
}
|
|
|
|
|
Hi,
Wouldn't something like Cells(YourRow,YourColumn).Select work?
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Have a look Developers Guide to the Excel 2007 Application Object[^], most of it is in VB.NET, but that's just syntax ....
I'm sure that you'll find something useful there ....
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Is this going to be the same excel file you'll be opening every time? You could put an 'AutoOpen' macro in the excel file (which would run anytime the file is opened, just enable macros when you open it) to do all this preliminary stuff you're doing in C#. It would be much easier in VBA anyway.
The Code Demon Rises.
|
|
|
|
|
This should do it: Range.Activate Method[^] (Activates a single cell, which must be inside the current selection. To select a range of cells, use the Select method.)
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|