|
i use ms word in my c# application how i use it
|
|
|
|
|
|
Learn English a bit better. Your past two posts are poorly constructed and make no sense. You cannot use MS Word inside of your C# app (embedded in it if that is what you are trying to do). You can, however, use Microsoft Interop classes to bridge with Word.
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
how i can take an array with it's value from form to another
and i need to use this array after closing the form.
Assaf
|
|
|
|
|
Do you mean that u have a form with few TextBoxes and you want to save values in these TextBoxes in an array?
Try this then:
string[] arr = new string[numberOfTextBoxes];
arr[0] = textBox1.Text;
arr[1] = textBox2.Text;
or, if you load TextBoxes dynamically:
List%lt;string> lst = new List<string>();
foreach(Control c in this.Controls)
{
if (c is TextBox)
lst.Add(c.Text);
}
string[] arr = lst.ToArray();
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
I have the array with value, i want to pass the whole array from this form to another form and close this one?
Thanks in advance
Assaf
|
|
|
|
|
An example:
you declare an array in form1
Public Static String[] arr = new String[100];
And in form2 you can do form1.arr[1] = "";
See that an array uses a fixed size, if not desired, you'd might checking out ArrayList.
|
|
|
|
|
|
Close
1) It should not be static if it is related to the instance of the form (which it is given the example).
2) It should not be public as it is a field. Make a property instead.
3) ArrayList was something we used back in the old days, now we use ObservableCollection<t> or at least List<t>.
|
|
|
|
|
hehe
1) Yes correct, but if it is an object that is between those forms only it isn't so bad if it is static (shared in vb.net) you just need to keep your head with in updating the object
2) yes, totally true, better is to make it a property, maybe I gave to much a quick and dirty solution
3) I didn't know the ObservableCollection and I looked it up and it is for .NET 3.0 only. I am using ArrayList a lot and it is working great for me But maybe List is better because you have the sort things etc...
Thanks for the added value, I can learn from it
|
|
|
|
|
1) A lot of beginner in OO have problem with the difference between a class and an object. Hence it is a problem "mudding" the concept by using statics.
3) The main reason to use List<t> is not that it has sort etc (ArrayList has that as well). The reason is that it is strongly typed. Besides making the code a LOT easier to write (and read) it does offer some performance benefit on value type collections as well. It's not just the ArrayList that has been replaced - you have Dictionary<keytype, valuetype=""> instead of Hashtable etc.
The System.Collection.Generic still have on main problem: They do not raise events when changed... which pretty much means they are useless in a lot (if not most) cases, as you can't build a prober UI on them.
|
|
|
|
|
hi guyz!!
I have a problem with datepicker, i want to know if the dropdown is currently open or not.. i need that in my condition, i really need your help, tnx in advance.
|
|
|
|
|
I'm going to assume you actually mean the DateTimePicker[^] control. In order to do this, you will need to handle the DropDown[^] event, which occurs when the calendar dropdown is shown, and the CloseUp[^] event, which occurs when the calendar dropdown is dismissed.
|
|
|
|
|
I've tried so hard for a whole day that I still cannot get through this tough problem, somebody please, help me!
I've got the code for Multi Column Combo in DataGridView to solve the problem of displaying multiple data, but I got stuck in displaying some values. Everything goes just fine, but when I tried to display values with the key value diplicated, it doesn't work. For example, I intended to display two rows "bmx2100 |23455 |34" and "bmx2100 |11111 |100", they have the same attribute "bmx2100", but the primary key "23455" and "11111" are different. That was what suppose to be, but now, the program displayed "bmx2100 |23455 |34" twice, and during DEBUG, I print out all the temporary variables and I found that they are all correct! So, what would be the problem!?
This is the Multi Column Combo Cell : http://www.codeproject.com/useritems/Multi_Column_Combo_Cell.asp
And this is the code snippet I modified:
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e)<br />
{<br />
Rectangle rec = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);<br />
DataGridViewMultiColumnComboColumn column = ownerCell.OwningColumn as DataGridViewMultiColumnComboColumn;<br />
DataTable valuesTbl = column.valuesTbl;<br />
string joinByField = column.joinFieldName;<br />
SolidBrush NormalText = new SolidBrush(System.Drawing.SystemColors.ControlText);<br />
object currentItem = Items[e.Index];<br />
string currentText = GetItemText(currentItem);<br />
<br />
if (e.Index > -1)<br />
{<br />
SolidBrush normalBack = new SolidBrush(Color.White);
e.Graphics.FillRectangle(normalBack, rec);<br />
if (DroppedDown && !(Margin.Top == rec.Top))<br />
{<br />
int currentOffset = rec.Left;<br />
<br />
DataRow[] itemRows = valuesTbl.Select("[" + joinByField + "]='" + currentText + "'");<br />
<br />
SolidBrush HightlightedBack = new SolidBrush(System.Drawing.SystemColors.Highlight);<br />
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)<br />
{<br />
e.Graphics.FillRectangle(HightlightedBack, rec);<br />
}<br />
StreamWriter sw = new StreamWriter(File.OpenWrite("record"));<br />
foreach (DataRow currentRow in itemRows)<br />
{<br />
bool addBorder = false;<br />
<br />
foreach (object dataRowItem in currentRow.ItemArray)<br />
{<br />
string value = dataRowItem.ToString();
<br />
<br />
<br />
#region DrawLine<br />
if (addBorder)<br />
{<br />
SolidBrush gridBrush = new SolidBrush(Color.Gray);
long linesNum = lineWidth;<br />
while (linesNum > 0)<br />
{<br />
linesNum--;<br />
Point first = new Point(rec.Left + currentOffset, rec.Top);<br />
Point last = new Point(rec.Left + currentOffset, rec.Bottom);<br />
e.Graphics.DrawLine(new Pen(gridBrush), first, last);<br />
currentOffset++;<br />
}<br />
}<br />
else<br />
addBorder = true;<br />
#endregion<br />
<br />
SizeF extent = e.Graphics.MeasureString(value, e.Font);<br />
Rectangle textRec = new Rectangle(currentOffset, rec.Y, (int)extent.Width + 20, rec.Height);<br />
<br />
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)<br />
{<br />
SolidBrush HightlightedText = new SolidBrush(System.Drawing.SystemColors.HighlightText);<br />
e.Graphics.FillRectangle(HightlightedBack, currentOffset, rec.Y, fixedAlignColumnSize, extent.Height);<br />
e.Graphics.DrawString(value, e.Font, HightlightedText, textRec); sw.Write(value + "|");<br />
}<br />
else<br />
{<br />
e.Graphics.FillRectangle(normalBack, currentOffset, rec.Y, fixedAlignColumnSize, extent.Height);<br />
e.Graphics.DrawString(value, e.Font, NormalText, textRec); sw.Write(value + "|");<br />
}<br />
currentOffset += fixedAlignColumnSize;<br />
}<br />
sw.WriteLine();<br />
}<br />
sw.Close();<br />
}<br />
else<br />
e.Graphics.DrawString(currentText, e.Font, NormalText, rec);<br />
}<br />
}<br />
<br />
}
|
|
|
|
|
You should ask this in the article's discussion forum, not here. There is a higher chance that the question will get answered by the original author that way and, since it is a question related to a specific article, other people will be able to see it along with the article.
|
|
|
|
|
I'm new here so I'm appreciating your help. You mean the "Article Requests and Ideas" forum? I just post another thread in that forum. Thank you for your help.
|
|
|
|
|
No, that forum is for people to submit ideas for articles. Each article has a discussion forum associated with it, that you can see at the bottom of the article. You get to the discussion forum for the article by going to that articles web page.
|
|
|
|
|
How to make a label (label1 ) move with the arrow keys, with up making it move up, down, down, right,... Thanks in advance -M.S.
|
|
|
|
|
Hi,
expanding on number 4 of my earlier reply to you[^], give the Control you draw on a KeyDown handler, and compare
KeyEventArgs.KeyCode with Keys.Up/Down/Left/Right; on a match, change your drawing parameters
and Invalidate the Panel.
If you insist on "drawing" with a label, change the Location of your label (no need to
invalidate then).
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I see what you're getting at, but do you have any specific code, I'm still pretty new to C#, but going along... Thanks, though.
|
|
|
|
|
Hi,
what you could do is read my Sokoban article and code, it is a puzzle tool with simple
graphics.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
|
On CodeProject.
you can find it using the CP Search engine, using Google, or by clicking "My Articles" below.
Do you really want to become a programmer, then learn to look around and search a little...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hey im having a problem with threads and Connections.
When the user loging to my program im trying to update the status bar.
just a small loop that will run for 7 sec (avg),
but when im sending the loging info to the database with a thread, the thread is closing my connection and fail.
*.when im not using threads all working good.
*.im using oracle 8 database.
*.is there someting i need to do with the connection string ?
btw i know how to work with threads it's just dont working with a connections
|
|
|
|
|
michael@cohen wrote: i know how to work with threads
Are you sure?
Try it without the status bar update, and if that runs fine, start using Control.InvokeRequired
and Control.Invoke (plenty of examples around).
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|