|
Hi,
I am not a good c# developer so not sure how to do what you suggested.
Can you make it simpler or guide me through it further please?
Thanks
|
|
|
|
|
Sorry, no spoon feeding here. I gave you all the required keywords, let Google and MSDN provide you
with the details; and CodeProject holds thousands of interesting articles too.
PS: don't switch Controls, if ListBox is your first choice, stick with it. It is a very good performer.
|
|
|
|
|
|
Luc Pattyn wrote: Sorry, no spoon feeding here.
He may not get what he wants (maybe mashed peas, squash, etc)
"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
|
|
|
|
|
For a start, the loop is incorrect. It'd probably be something like this
for(int i = 0; i<3; i++)
{
lstBox1.Items.Add("item" + i.ToString("N0"));
}
Also, the standard ListBox cannot do that on its own. You could paint it yourself if you have a good grasp of the Graphics object, or you could use the ListView. The loop would change to something like this
for(int i = 0; i<3; i++)
{
ListViewItem lvi = new ListViewItem("item" + i.ToString("N0"));
lvi.BackColor = Color.White;
ListView1.Items.Add(lvi);
}
|
|
|
|
|
Hi,
I am trying to use a listview to make this easier.
Do you know why I do not get Color in the intellisense please?
Thanks
|
|
|
|
|
Have you added
using System.Drawing;
to the top of the file?
|
|
|
|
|
|
Hi all,
Can anyone help...im trying to figure out a way to get the value to text of a node...the problem is that my query returns around 2000 rows...i want to make it that i must click on a node to get its subnodes...how will i go about doing this?
living life on the flip side
|
|
|
|
|
|
Hello,
I am working in my application with xml files and mdb file,I don't want user view these files I want to put them in the app assembly.
Thanks.
Dad
|
|
|
|
|
yes it works for xml files but I don't know if mdb will work or won't work.
1. add a classLibrary project in your solution,
2. add the xml files into your new classLibrary project.
accessing to xml:
System.Reflection.Assembly xx = System.Reflection.Assembly.Load("yourNewClassLibraryProjectName");
string ress = xx.GetManifestResourceNames();
and you will read with xmlSerializer.
I'm not sure if you can change dinamically that xml files or not... .
modified on Wednesday, July 16, 2008 8:23 AM
|
|
|
|
|
The only real purpose of including the mdb file in the assembly is to have an already structured template for database creation/editing. You would not be able to edit the files embedded into the assembly. If you want to 'obscure' what the user can and cannot see with regards to the actual database file, I would suggest that you give it a 'critical application important file' type name. Second I would suggest that you give it an abnormal database extension. Ex. For my RevCorp accounting software I wrote, I labeled the file: AppData.revdb. Their was a copy of the file stored in the assembly. When the file could not be found in the directory where it was run the database was created from the assembly.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
I have created a setup of a win project and i installed the project on client machine.now i update my project and create a new version of setup.
now on client machine it shuld be updated it self
i need your help
thanx
|
|
|
|
|
ali zaidi wrote: now on client machine it shuld be updated it self
Not unless you have written some code in your app to do it. Google for .net deployment, there are loads of articles showing the problems and pitfalls.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi All,
Can anyone tell me wat im doing wrong...im trying to populate a treeview from sql with a foreach loop...my code is like this..
foreach (DataRow dr in dt.Tables)<br />
{<br />
<br />
}<br />
Please tell me wat im doing wrong?
living life on the flip side
|
|
|
|
|
if dt is a DataSet then dt.Tables is a collection of Table s, not DataRow s. If dt is a DataTable (as the name suggests) you want dt.Rows
|
|
|
|
|
thanks alot...works like a bomb...thanks to all
living life on the flip side
|
|
|
|
|
ok thanks for your help but now i have another question...im trying to add subchild nodes to childnodes... my code
ListItem lstItem = new ListItem();
foreach (DataRow row in dt.Rows)
{
TheNode13.Text = "";
lstItem.Value = row["ID"].ToString();
lstItem.Text = row["Name"].ToString();
TheNode13.Text = lstItem.Text;
TheNode13.Value = lstItem.Value;
TheNode12.Nodes.Add(TheNode13);
}
everytime i add them then it overwrites the subchildnode and add the same node twice...wat am i doing wrong?
living life on the flip side
|
|
|
|
|
You need to instantiate a new TreeNode each time.
|
|
|
|
|
try dt.Tables[0].Rows
rahul
|
|
|
|
|
foreach (DataRow dr in dt.Tables.Rows)
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
I'm busy working on some user controls...
these are made up of 2 panels on which data is drawn using GDI+ in the form of time lines and clocks. On the time lines i have maskedTextBoxes with the mask "##:##" and in turn shows up as "__:__" when empty.
In the TextChangedEventHandler of each maskedTextBox I try to parse the value to a DateTime property, so if the user input is a valid time the corresponding property to the maskedTextBox is set.
Also in the TextChangedEventHandler the method DrawData() is called which sets some private bool's when certain groups of these DateTime properties are filled in correctly. Ex if the start and stop time of a break is filled in as 09:00 and 09:30 a pie will be drawn behind the clock representing the break.
so far so good. The irritation sits in the containing forms designer code. As per a different thread monday(i think) i noticed my properties set block was getting executes BEFORE the user enteres text in the MaskedTextBoxes. So upon construction of the control all my MaskedTextBoxes had "00:00" in them instead of "__:__".
It was later discovered that the containing form initailizes the properties in its designer code which was executing my set blocks.
as a work around i did the following...
private DateTime postEnd = new DateTime();
public DateTime PostEnd
{
get
{
return postEnd;
}
set
{
postEnd = value;
if (postEnd != new DateTime())
{
mtxtPostEnd.Text = postEnd.TimeOfDay.ToString();
}
}
}
this was working but only for a few of the properties, the others was STILL SHOWING "00:00"
i went screwing around in the designer code again and this is what i found...
this.breakClockControl3.AfterTime = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.BreakEnd = new System.DateTime(((long)(0)));
this.breakClockControl3.BreakStart = new System.DateTime(((long)(0)));
this.breakClockControl3.BreakType = "Windo";
this.breakClockControl3.Dock = System.Windows.Forms.DockStyle.Fill;
this.breakClockControl3.Duration = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.Location = new System.Drawing.Point(3, 3);
this.breakClockControl3.Name = "breakClockControl3";
this.breakClockControl3.PostEnd = new System.DateTime(2008, 7, 17, 0, 0, 0, 0);
this.breakClockControl3.PostGrace = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.PostRound = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.PreGrace = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.PreRound = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.PreStart = new System.DateTime(2008, 7, 17, 0, 0, 0, 0);
this.breakClockControl3.ShiftEnd = new System.DateTime(2008, 7, 17, 0, 0, 0, 0);
this.breakClockControl3.ShiftStart = new System.DateTime(2008, 7, 17, 0, 0, 0, 0);
this.breakClockControl3.Size = new System.Drawing.Size(486, 317);
this.breakClockControl3.TabIndex = 0;
as you can see some of the DateTime's are initialized as new System.DateTime(((long)(0))); which is perfect and others like new System.DateTime(2008, 7, 17, 0, 0, 0, 0); which screws up my work around
Why does the designer do this? i don't get it...
any ideas on what i can do?
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
This is to do with DesignerSerialization. Look up on how to suppress properties, set defaults, visibility, etc.
|
|
|
|
|
thanx leppie
google here i come!
it just makes no sense to me that two of the exact same things gets initialized to two different values for no apparent reason, stupid MS...
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|