|
i dont understand that using a desktop application
|
|
|
|
|
hello
is there a simple way to read cells data from excel file in my projects directory
into an array or matrix in c# ?
|
|
|
|
|
|
Good link.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
i tried to use this code and i have two questions.
1) it gives me an error that i dont have oledb registered on my machine how can i get it?
2) i understand that i get the information as dataset. how can i copy the information to an array.
3)the code has some line with dataGridView1 the compiler doesnot like this. what is it ?
|
|
|
|
|
1) I believe you have to install MDAC or the driver. You can find more info here: http://support.microsoft.com/default.aspx?scid=kb;en-us;239114[^]
2) You would just take that DataSet and iterate through it as necessary.
Something like...
foreach (DataTable table in dsDataSet.Tables)
foreach (DataRow row in table.Rows)
foreach (DataColumn column in table.Columns)
... (Your code here) ...
Personally, there's not much reason to transfer it to an array. Because a DataTable/DataSet is already a great form for connecting it to other items.
3) Its a User Interface component. Remove that line.
|
|
|
|
|
ok thanks alot for the help
|
|
|
|
|
If my project has multiple forms, is it possible to launch a new form on it's own thread..? The form is launched during a loop that never stops (for monitoring for input through the network) and it hangs because of this.
Is it possible to make my new form it's own thread?
|
|
|
|
|
Yes, it's possible. There are some things you should be aware of:
1. The thread that launches the form must be STA. You can set this on a new thread by calling Thread.TrySetApartmentState.
2. You should talk to other forms on the thread that they were created on.
I really recommend against doing this for these reasons. #2 is a major pain in the butt.
I suggest looking for an alternative approach for these reasons.
|
|
|
|
|
When
ParentForm.Close += new EventHandler(ParentForm_Closed) event is called I am opening another child form. But childform open and then close automatically. I tried to get the child from closing reason like as shown below and it returns "Cancel". ChildForm shouldn't close unless the buttons on the childform are clicked. Why is it behaving like this does anybody knows.
DialogResult result = childForm.ShowDialog();
Console.WriteLine("Closing reason " + result.ToString());
|
|
|
|
|
Without seeing more code from your child form I couldn't answer this question
|
|
|
|
|
WinForms have a Main form which you called in Application.Run(new MainForm()); this form must be active while your application is running. Beside your Child forms in MDIParent need their parent to be activate even if your parent form is not your Main form.
Hope can help you
Life is 5: 3 me, 1 you.
|
|
|
|
|
|
|
Sorry...I didn't know where this belonged.
|
|
|
|
|
My .Net 3.5 WinForm app won't display menu item tooltips. I did all of the following using the designer in the IDE:
0) Added a MenuStrip control to my form.
1) Created some image-only menu items.
2) Set both the Text and the TooltipText properties to the desired text.
3) Set the AutoToolTip property to true (and I tried false to see if it would pick up the actual menu item text).
When I hover the mouse over a menu item, no tooltip shows up. What am I missing?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: When I hover the mouse over a menu item, no tooltip shows up.
Cannot reproduce
Visual Studio 2008 - 9.0.30729.1 SP
.NET Framework 3.5 SP1
XP Pro
5.1.2600 SP2
Last modified: after originally posted -- forgot system info
led mike
|
|
|
|
|
What classes did you use for menu items, ToolStripMenuItem?
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I used whatever the designer provided. I just checked it, and yes, it used ToolStripMenuItem .
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Odd, I tried with the following (just a fresh, single form application) and it worked fine. If you try this code do you still experience the same problem.
namespace WindowsFormsApplication4 {
partial class Form1 {
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent() {
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(284, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
this.toolStripMenuItem1.AutoToolTip = true;
this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem2});
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(125, 20);
this.toolStripMenuItem1.Text = "toolStripMenuItem1";
this.toolStripMenuItem2.AutoToolTip = true;
this.toolStripMenuItem2.Image = global::WindowsFormsApplication4.Properties.Resources._3_5_Disk_Drive;
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(152, 22);
this.toolStripMenuItem2.ToolTipText = "I\'m tooltip";
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 264);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "Form1";
this.Text = "Form1";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
}
}
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
No tooltips, and only one of the menu items showed up. I've already tried the "basic form" approach, and I didn't have any luck.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
The closest thing I found was this: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=115597[^], but it's old and for beta.
Since for example led mike couldn't reproduce, the code that worked for me didn't behave as expected for you, could this be an installation issue
I used (plus several hotfixes):
Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1
Edition: Professional
on Windows Vista SP1
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
As near as I can tell, I don't have VS2008/SP1 nor DotNet 3.5/SP1 installed on this system...
I'll try the same code at home and see what happens...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What is you code just tried work fine.
Learning to Code
|
|
|
|
|
lets say you set an initial byte[] size to 30 and the message that you receive has a size of 50. How would you handle that with Socket.BeginReceive
With Socket.Receive this would work:
byte[] buffer = new byte[30];
int size = Socket.Receive(buffer);
String msg = Encoding.ASCII.GetString(buffer, 0, size);
while(size > 0)
{
buffer = new byte[30];
size = Socket.Receive(buffer);
msg = msg + Encoding.ASCII.GetString(buffer, 0, size);
}
How would you do the same thing with Socket.BeginReceive?
Thank you,
Prateek
|
|
|
|