|
Yes you can, in both WPF and WinForms. Why not?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hello all
my problem is that for some reason, a simple assignment isn't working.
the dataGridView is binded to DB and im trying to assign a value type string to a column of type string
bindingSourceSchema.DataSource = null;
dgwSchema.Columns["colID"].DataPropertyName = "APP_ID";
dgwSchema.Columns["colName"].DataPropertyName = "DESCRIPTION";
dgwSchema.Columns["colTextbox"].DataPropertyName = "APP_ARGS";
dgwSchema.Columns["colTextbox"].HeaderText = "Parameters";
dgwSchema.Columns["colLink"].DataPropertyName = "APP_PATH";
dgwSchema.Columns["colLink"].HeaderText = "Path";
DataGridViewLinkColumn colLink = (DataGridViewLinkColumn)dgwSchema.Columns["colLink"];
colLink.UseColumnTextForLinkValue = true;
colLink.Text = "Edit";
bindingSourceSchema.DataSource = SchemaDB.GetGenericApps();
.
.
.
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
dgwSchema.CurrentRow.Cells["colLink"].Value = openFileDialog.FileName;
}
Thanks
Eyal
|
|
|
|
|
The reason is following property is set to true.
colLink.UseColumnTextForLinkValue = true;
Set it to false. Then it will resolve your problem.
|
|
|
|
|
hi....now im doing work on Line count for word documents...1st i hav 2 select Dr name n date n then add files in listview and then if i go for save those files will save in ms word table as separately as Different DR name n Date wise in seperate tables...
....BUT iam getting repeating in one table lik...
Dr.Name:Dr.Jhon
Date:20/12/2009
Sno FileName Count
1 Hobbs.doc 36.31
2 Horn.doc 45.72
3 McMillan.doc 41.49
4 Smith.doc 10.72
Dr.Name:Dr.king
Date:22/12/2009
Sno FileName Count
1 Hobbs.doc 36.31
2 Horn.doc 45.72
3 McMillan.doc 41.49
4 Smith.doc 10.72
..........................................................................
this is actully i want 2 get....
Dr.Name:Dr.Jhon
Date:20/12/2009
Sno FileName Count
1 Hobbs.doc 36.31
2 Horn.doc 45.72
Dr.Name:Dr.king
Date:22/12/2009
Sno FileName Count
1 McMillan.doc 41.49
2 Smith.doc 10.72
Here is my code...
private void btnsave_Click(object sender, EventArgs e)
{
for (int k = 1; k < listView1.Items.Count; k++)
{
if (listView1.Items[k - 1].Text != listView1.Items[k].Text)
{
dte.Add(listView1.Items[k - 1].Text);
dte.Add(listView1.Items[k].Text);
}
if (listView1.Items[k - 1].SubItems[3].Text != listView1.Items[k].SubItems[3].Text)
{
pname.Add(listView1.Items[k - 1].SubItems[3].Text);
pname.Add(listView1.Items[k].SubItems[3].Text);
}
}
object oMissing = System.Reflection.Missing.Value;
object oEndOfDoc = "\\endofdoc"; /* \endofdoc is a predefined bookmark */
Microsoft.Office.Interop.Word._Application oWord;
Microsoft.Office.Interop.Word._Document oDoc;
oWord = new Microsoft.Office.Interop.Word.Application();
oWord.Visible = true;
oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
for (int k = 0; k < dte.Count; k++)
{
Microsoft.Office.Interop.Word.Paragraph oPara1;
oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing);
oPara1.Range.Text = pname[k].ToString();
oPara1.Range.Font.Bold = 1;
oPara1.Format.SpaceAfter = 24; //24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter();
Microsoft.Office.Interop.Word.Paragraph oPara2;
oPara2 = oDoc.Content.Paragraphs.Add(ref oMissing);
oPara2.Range.Text = "Date:" + dte[k].ToString();
oPara2.Range.Font.Bold = 1;
oPara2.Format.SpaceAfter = 24; //24 pt spacing after paragraph.
oPara2.Range.InsertParagraphAfter();
int a = listView1.Items.Count + 1;
Microsoft.Office.Interop.Word.Table oTable;
Microsoft.Office.Interop.Word.Range wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oTable = oDoc.Tables.Add(wrdRng, a, 3, ref oMissing, ref oMissing);
oTable.Range.ParagraphFormat.SpaceAfter = 6;
oTable.Cell(1, 1).Range.Text = "SNO";
oTable.Cell(1, 2).Range.Text = "FileName";
oTable.Cell(1, 3).Range.Text = "Total Count";
for (int r = 1; r < a; r++)
{
oTable.Cell(r + 1, 1).Range.Text = listView1.Items[r - 1].SubItems[1].Text;
oTable.Cell(r + 1, 2).Range.Text = listView1.Items[r - 1].SubItems[2].Text;
oTable.Cell(r + 1, 3).Range.Text = listView1.Items[r - 1].SubItems[5].Text;
oTable.Rows[r].Height = oWord.InchesToPoints(0);
}
oTable.Columns[1].Width = oWord.InchesToPoints(0); //Change width of columns 1 & 2
oTable.Columns[2].Width = oWord.InchesToPoints(0);
oTable.Columns[3].Width = oWord.InchesToPoints(0);
oTable.Rows[1].Range.Font.Bold = 1;
}
MessageBox.Show("Save Successfully");
}
}
}
plzz...help me ............thanquuu....
|
|
|
|
|
Looks like you've got some homework to do.
There's nothing left in my right brain and nothing right in my left brain. |
|
|
|
|
|
I've heard a lot of whining about VS2008 here, but I'm fairly impressed by a few things that have been added. For one, Intellisense is working a lot better for me than in any previous version. It often seems to anticipate my needs, settling on an item in the list that is exactly what I was going to look for. I noticed this particularly while using the Convert function to switch between numerical record types and form text box values. It seems to check the source and target types in advance, then position the selector in the right place in the list to find the exact conversion required. Nice!
A second feature that I like is the appearance of alignment lines on the Design sheet when moving form elements around trying to line them up nicely with other objects on the page. I didn't use 2005 at all, or 2003 very much, so I'm not sure when this appeared. But it sure saves me a lot of tedious switching back and forth among page element properties to find the exact coordinates of each to make everything line up. Very nice!
Of course, this wouldn't be a proper Roger post if I didn't include a dumb question, so here it is:
When is it preferable to use a String class, rather than a simple string type for text data? If it makes a difference that I'm using SQL Server for storage, rather than a text file, I'd like to know about it. If not, is there any advantage in using one over the other?
On reflection (not a pun, really!), there's another question that occurs to me. There used to be a huge problem with integer types when changing DBMSs (SQL Server, Access, MySQL, etc) and languages. The VB integer was not the same as the C++ integer, and Access assumed a default type different from what SQL Server expected to handle. With the introduction of the CLR, has this issue been resolved? If I write all my GUI stuff using Int16 types, will I have to rewrite it all or convert it to store the data in SQL Server or Access?
On that note, I'll go back to coding...
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Roger Wright wrote: When is it preferable to use a String class, rather than a simple string type for text data?
Both String and string are one and the same thing. So, no difference whatever you use.
Roger Wright wrote: With the introduction of the CLR, has this issue been resolved?
Yes. I guess you are refereing to interoperability here. Right?
Roger Wright wrote: If I write all my GUI stuff using Int16 types, will I have to rewrite it all or convert it to store the data in SQL Server or Access?
I don't know about access, but SQL should accept int16 in Int.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Personally I think VS2008 is awesome. Have a look at Xcode on a Mac if you want to see pain.
Regards,
Rob Philpott.
|
|
|
|
|
Roger Wright wrote: a dumb question
I don't recall you asking any others.
Roger Wright wrote: String class, rather than a simple string type
That's been asked and answered a couple of times in the last few weeks.
|
|
|
|
|
hi,
i have generated a report using report viewer..can i add a column programaticaly to that report..
thanx.
|
|
|
|
|
|
So, i realize this isnt the typical question asked here but i figured if anybody knew it would be a developer here so i figured ill ask.
Creating a C# NNTP application, nothing special.
Connect fine, authenticate fine, issue the group command fine.
My question comes with why i always get a 423 Article does not exist in group error when i try to issue a BODY command...looking at the Sabnzbd logs you just issue something like BODY 5RWjdHIhlUv5rCR7Nqu8@JBinUp.local
If i issue that myself i get back that its not found. Is there something i need to do beyond issuing the GROUP command to point to that group for my BODY commands?
Ive looked at a ton of examples and they all just use ARTICLE or BODY followed by the messageID followed by just a regular integer article number, which if i do works fine..when i try issuing it with a NZB style messageID it never works.
Any help?
|
|
|
|
|
In fact you may miss the authentication operation that may be necessary.
This is a common error, the 423 may be returned because your are not authenticated.
Check this.
|
|
|
|
|
The problem:
1. Start a new (Windows Forms Application) Project in Visual C#
2. Drag a Button onto the main window "Form1", and give it a name, "button1"
3. Drag another Button onto the main window, and give it a name, "button2"
Now the project consists of a main window and two push buttons.
How can I create a collection of these graphical widgets (actually, references to the widgets, since the widgets already exist) such that I would be able to:
1) iterate through the collection, and access each items' methods and attributes.
2) access any graphical widget in the collection by its name.
Is this possible in C#? Thanks for any help.
|
|
|
|
|
|
|
I'd define what exactly I want and then write some code.
|
|
|
|
|
You'll find your form has a collection called 'Controls' which you can iterate over. Each element is a Control (Button, textbox etc.) which you can cast to the correct type and access its properties.
foreach (Control control in Controls)
{
if (control is Button)
{
((Button)control).PerformClick();
}
}
Probably not the best way to do it - but it depends what your requirements actually are..,,
Accessing a control by its name is what you normally do?
Button1.Text = "Hello World";
for example.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Hi Cron-Fed,
I, and I am sure others here, will be happy to help you, but your question here, imho, could be clarified.
What is the final result you are after here : do you want :
1. an application with one form which contains (is the parent of) of identical widget forms ?
2. an application which has one "master form" or "main window" which then creates one or more of your widget forms as "independent" external windows : and manages them ?
3. an application where there are a bunch of "independent" widget forms each identical. each having "knowledge of" or the ability to send and receive "messages" to ? i.e., : there's no one "main" or "master form" ?
My intuition here is that you are talking about wanting a collection of UserControls, but I'm not psychic
Please describe more precisely what you want to see on the screen when you launch your application.
best, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844
|
|
|
|
|
Hi ,
I guess you want to reuse that form again and again...right ?If you can create a user control...that will do the trick.Am I right ? 
|
|
|
|
|
My goal is to be able to:
- access each graphical widget by instance name (Tag or Text attribute)
- change each widget's attributes according to an external data source
The "external data source" will be a class that parses a windows .ini file, that contains attribute,value pairings. Something like:
[Button_001]
type = toggle_button;
on_text = "On";
off_text = "Off";
on_color = "Red";
off_color = "White";
etc. etc.
where "Button_001" is the Tag or Text attribute of a button widget already placed in the gui.
|
|
|
|
|
|
Hi Cron-Fed,
Looking at all the posts on this thread, I'm still not as clear about what you are doing as I'd like to be.
So here's a few final comments just based on "intuition" :
1. the business of reading in from an .ini file to construct a whole set of components seems to me like something that would fit "naturally" with using XML : using XML files and capabilities you can save and restore whole hierarchies easily.
2. my guess is this what you are after here is a way to serialize and de-serialize a whole bunch of controls (possibly nested) : do look around CP for serialize and deserialize examples.
3. my guess is you may want to think about a TreeView as a container for your "overview" of Controls rather than a just a ComboList : after all using a TreeView will map naturally to nested collections of Controls. It will also "map naturally" to hierarchies expressed in XML. I'm pretty sure CP has some articles on saving and restoring TreeView nodes and content.
4. you can actually use the Winforms PropertyGrid control on a WinForm Application at run-time to show you all the properties of any control in the same way you see them at design-time : you can even edit the properties :
set the SelectedObject property on the PropertyGrid to the Control you want to display the properties of :
note this control, must use Reflection to reconstruct the properties and to enable dynamic round-trip updating : can be slow it used at run-time.
good luck, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844
modified on Friday, December 18, 2009 7:44 PM
|
|
|
|
|
Hello,
System.Data.OleDb.OleDbCommandBuilder cb = new System.Data.OleDb.OleDbCommandBuilder(dAdapter);
if (current_list == "list1")
{
DataRow row = myset.Tables["list"].NewRow();
int y;
y = myset.Tables["list"].Rows.Count;
row["ID"] = y + 1;
row["word"] = s;
row["perc"] = 0.5;
myset.Tables["list"].Rows.Add(row);
dAdapter.Update(myset, "list");
}
I used break points to confirm that the data is updated here, however, for some reason when I check the database another table is updated instead of "list"
Where could be the problem? I checked the code several times, but I'm not sure 
|
|
|
|
|
I don't use dataadapters or datatables, for me they are legacy. But, how is the command of the dataadapter built?
If you pass a custom SQL to the data-adapter (I really don't know if this is the case), that could be the cause, not the code block you showed here, as here the data adapter already exists.
|
|
|
|
|