|
imannasr,
Google?[^]
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
I have this large number of textboxes which is 16 textboxes across and 16 textboxes down, totaling 256 textboxes.
I have this software that generates the hex display all will be displayed at the same time. I noticed that there is the lag of time to populate each of them.
An engineer of mine thought about using Textboxes[] but I am not sure if its possible to "link" the textbox array with the cells that are on the GUI.
For example:
for the control that is on the screen is named tbCell_00 and next to it is tbCell_01
now for the textbox array, is it possible to do this for the two textboxes above:
TextBox[] tBoxes = new TextBox[2];
tBoxes[0] = tbCell_00;
tBoxes[1] = tbCell_01;
Anyone can help?
Thanks!
|
|
|
|
|
Yes, that will work fine ( did you try it ? )
A textbox is a class, so all you're doing is organising references to the existing controls, not creating deep copies.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
okaay. I did try that and it works. But I would have to do that 256 lines for each textboxes.
I'm not sure how to use for-next loop to Control TextBox's name "tbCell_00"
for example,
for (int i = 0; i < 2; i++)
tBoxex[i] = tbCell_00;
\-------/
this is the issue: ^
since that tbCell_00 is the Gui's textbox name. Is there a way to convert string into TextBox's name so I can use it as part of for_Next loop.
for example: "tbCell_" + i.ToString("X2") <---- Convert that to TextBox Name
|
|
|
|
|
You could use reflection to find textboxes that way. Why not just use a 2 dimensional array ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
why not try like this:
Control [] o = Controls.Find("textBox1", true);
the method Controls.Find() may be suitable for your situation.the first argument is your name of specific textbox control.
EG.
for (int i = 0; i; 2; i++)
tBoxex[i] = Controls.Find("tbCell_" + i.ToString("00"), true);
have fun!
|
|
|
|
|
I like that. So I tried this code:
TextBox[] tboxes;
for (int i = 0; i < 256; i++)
tboxes[i] = this.Controls.Find("tbCell_" + i.ToString("X2"), true);
and I got this error:
Cannot implicitly convert type 'System.Windows.Forms.Control[]' to 'System.Windows.Forms.TextBox'
|
|
|
|
|
because Controls.Find returns an array of Conrols hence the Control[] in the exception.
Dave
|
|
|
|
|
1. Call SuspendLayout() when creating the text boxes and ResumeLayout() after that (consult how VS generate the code in InitializeComponents()).
2. Enable double buffer on the forms.
3. Do you repopulate each and every textboxes every x seconds? Does the values change very frequently? Are you using DataBinding?
4. If the textboxes are only for display (no editing from user), you may want to consider different kind of control for displaying (DataGridView, ListView, owned drawn display, etc).
|
|
|
|
|
Item 1: No difference.
Item 2: Double Buffer? Not sure how to do that.
Item 3: No not every x seconds. I do re-populate after clicking on the button to obtain the hex dump from a memory chip.
Item 4: Could try for DataGridView.
|
|
|
|
|
Double Buffer can be found as Form property.
|
|
|
|
|
Why don't you use a DataGridView ? You have several predefined cell-types, textbox, combobox, checkbox,...
|
|
|
|
|
I have a custom control which produces a fairly intricate graph that takes some time to initally draw. The user uses the mouse to draw a selection rectangle on part of the image to be zoomed in on. This part of the code works fine, but the drawing is sluggish.
Right now, as the user clicks and drags, the graph is drawn and the rectangle is then drawn over that, so each time the user moves, the image must be redrawn. I know part of the paint message is the region that was invalidated, but its too complicated to redraw just a portion.
Is it possible to store the control image as a bitmap after drawing the first time, then whenever the mouse moves, replace the image with the bitmap stored in memory and draw my new selection rectangle? Is this a good approach, and if so, how do I get and set the control image? If this isn't a good approach, what is a better one?
Thanks,
Aaron
modified 12-Jul-20 21:01pm.
|
|
|
|
|
Yes, just draw the graph to the bitmap in the first place, and draw that in your paint event.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
That was very simple to get working, changes for the reassurance
modified 12-Jul-20 21:01pm.
|
|
|
|
|
hi
i have a method that return DataTable (named GetData), now i want to load returned DataTable object to DataSet by this code :
this.ds.Load(dal.GetData(cmd1).CreateDataReader(), LoadOption.OverwriteChanges, new string[] { "transaction1" });
but before, load data, i want to clear some tables of my dataset objects by this code :
this.ds.Tables[0].Clear();
but at runTime the following error has shown me :
Cannot find table 0
how to solve my problem and how to clear before fill ?
thanks
|
|
|
|
|
hdv212,
if (this.ds.Tables.Count != 0)
{
this.ds.Tables[0].Clear();
}
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
First check your dataset have any table. If not no need to clear.
kesavan
|
|
|
|
|
Hello All,
I have this one asp.net 2.0 project that throws the following error when I attempt to use System.Diagnostics.Debug.WriteLine
{"Couldn't create listener 'textWriterTraceListener'."} System.Exception {System.Configuration.ConfigurationErrorsException}
It has an interesting inner exception of:
InnerException {"Illegal characters in path."} System.Exception {System.ArgumentException}
All of the other asp.net 2.0 apps I have run perfectly fine with that statement and previous versions of this application ran fine. Any ideas?
Thanks in advance,
Ryan
|
|
|
|
|
RB@Emphasys,
Show us some code.
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
I'm not sure exactly what you're looking for, it's simply erroring out when attempting to writeline, but here is the if statement:
if (CertificationPerson_RaceTable.GetRecords("IsActive = 1 And fkPerson = " + oCertPersonRecord.PK).Length == 0)
{
System.Diagnostics.Debug.WriteLine(oCertPersonRecord.PK + " " + oCertPersonRecord.fkRace);
oPersonRaceRecord = new CertificationPerson_RaceRecord();
oPersonRaceRecord.fkPerson = oCertPersonRecord.PK;
oPersonRaceRecord.fkRace = oCertPersonRecord.fkRace;
oPersonRaceRecord.Save();
}
Thanks,
Ryan
|
|
|
|
|
Check your application settings (web.config). Sounds like it's trying to trace to a file but someone made a typo in the file name or path.
As in:
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="myListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="InvalidFileNameHere.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
I bolded the place to look for the error.
Peter the small turnip
(1) It Has To Work. --RFC 1925[^]
|
|
|
|
|
Thanks Peter,
That did the trick. I spaced out on that one....
Ryan
|
|
|
|
|
Hi all!
I create a class that extends UserControl, and so, I try to add some mouse events to the objects that my app creates dynamically.
It follows the class UserControlEx, the one that I created.
public class ControlEx : System.Windows.Forms.UserControl {
private bool isDragging = false;
private int clickOffsetX, clickOffsetY;
KineticaRT.Controls.Dial lblDragger;
public ControlEx (System.Windows.Forms.TabPage tabPage) {
this.lblDragger = new KineticaRT.Controls.Dial();
this.lblDragger.Enabled = true;
tabPage.Controls.Add(this.lblDragger);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(controlEx_MouseUp);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(controlEx_MouseMove);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(controlEx_MouseDown);
}
private void controlEx_MouseDown (System.Object sender, System.Windows.Forms.MouseEventArgs e) {
isDragging = true;
clickOffsetX = e.X;
clickOffsetY = e.Y;
}
private void controlEx_MouseUp (System.Object sender, System.Windows.Forms.MouseEventArgs e) {
isDragging = false;
}
private void controlEx_MouseMove (System.Object sender, System.Windows.Forms.MouseEventArgs e) {
if (isDragging == true) {
this.Left = e.X + this.Left - clickOffsetX;
this.Top = e.Y + this.Top - clickOffsetY;
}
}
private void InitializeComponent() {
this.SuspendLayout();
this.Name = "ControlEx";
this.ResumeLayout(false);
}
}
As you can see, the constructor of the class, creates the object and adds the events to the control(lblDragger).
But, a problem occurs. When I press the mouse down and I try to drag the object nothing occurs. The mouse up functions also does not work.
private ControlEx dial;
private void button1_Click(object sender, EventArgs e) {
if (tcDataPanes.TabCount == 0) {
TabPageEx tabpage = new TabPageEx(tcDataPanes);
}
dial = new ControlEx(tcDataPanes.SelectedTab);
}
How can I solve this problem?
Thank you in advance.
Gustavo
|
|
|
|
|
Hi.
I need to display some information in the system tray using the notifyicon control, but the the notifyicon control only allows me to draw on a 16*16 space but I need around 16*64 space, How can I do this?
|
|
|
|