|
I'm not 100% sure about your question - what I think you're saying is only the Date is showing up.
If this is so it's because it looks like each line you have in bold is replacing Range.Text with a new value where you should be appending to it instead. What if you try something like this:
string contactInfo =
contact_name.Text + Environment.NewLine +
contact_address_home.Text + Environment.NewLine +
contact_country.Text + Environment.NewLine +
contact_postcode.Text + Environment.NewLine +
string.Format(DateTime.Now.ToShortDateString());
oPara1.Range.Text = contactInfo;
instead?
|
|
|
|
|
In Visual C++ programing, we can change the icon of the EXE file.Is it possible to change the icon of a window form program's EXE in C#? if it is then i will be grateful if anyone tell me about it...
waiting....
|
|
|
|
|
Try googling around
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Some comments on applications and icons:
1.
An application typically has two different icons:
- the application itself has an icon at the file level; it gets used by Windows Explorer;
you set it as a project property.
- any form can have an icon; it is a Form property, that you can set through Visual
Designer. It also shows up in the task bar's button (if the Form shows in task bar).
2.
an icon file can hold multiple icons (icons at different sizes), and Windows will pick
one depending on circumstances, so if they do not all look alike, you may get very
confused.
3.
I tend to create icons programmatically; the following code converts a (best small, square) image into a simple icon:
string filename=popupNode.getLongName();
try {
Bitmap bm=(Bitmap)Image.FromFile(filename);
if(bm.Width!=32 || bm.Height!=32) {
bm=new Bitmap(bm, 32, 32);
}
Icon icon=Icon.FromHandle(bm.GetHicon());
bm.Dispose();
string filename2=Path.ChangeExtension(filename, ".ico");
Stream stream=new FileStream(filename2, FileMode.Create);
icon.Save(stream);
env.output("Created icon "+filename2);
} catch(Exception exc) {
env.output("Failed to create icon from "+filename);
env.log(exc);
}
Hope this helps.
|
|
|
|
|
Thnxx for sharing this precious info!
But the fact is i ve changed the form icon as u mentioned i guess.Now i want to change that exe file icon. say in the debug there is a exe file named "dark.exe".This file has its typical exe icon.you know which is common for windows! tht window like. Now as in visual C++ we can change exe file icon to any icon file we want or can convert a bitmap to icon file like you ve posted the code for it.There is already option for tht in the IDE.
If there is an option present in C# IDE(i m using Visual Studio 2005 by the way) then i ll be glad if you tell me if u know already!
or other method ....
|
|
|
|
|
Hi,
the app's exe icon is a project property, hence right click the project in the
solution pane, choose application tab, and specify the icon file/resource there.
|
|
|
|
|
Just look in the properties pages for the project. If you want to embed multiple icons into the executable which are viewable by Windows then might I suggest taking a look at my article[^].
Shameless self-publicising but hey...
|
|
|
|
|
hi .. imanage to write my code on insert, update and delete fucntion in c#..
but why whenever i insert or update or delete the data..
it shows messagebox on this below
Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead.
|
|
|
|
|
If you put the error message in quotes and google it, that's the best way to solve these sort of problems. It would be wise of you to post some code if you want more specific help, I can only guess at what your code looks like.
Specifying update/insert/delete SQL direct in code is easy, but it's not the way to go if you want to write professional quality code.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
I have written a very basic windows application that connects to a mysql database, invoke some functions,write on the database and get a string as a result to be used in my program. This is a periodic event and I use timers to periodically invoke these functions. These program has users who needs to login and authentication is done in the database by the stored procedures and functions. I keep a track of log off times by invoking a function in the database by a timer every 30 seconds which basically updates the logout time when the proram is running so if the user loses the connection somehow, then I have a 0-30 seconds error margin for logout time.
But I think the program has some flaws. Firstly I heard that there are some programs that can actually show the code of an exe. I am worried that someone can easily see the code of my exe, get the username, password and adddess for the user and also the names of the functions and after writing a simple program like mine, can access, run and retrieve the data I want retrieve with my own program but my program only. I want to put security measures in my program but these does not make any sense if anyone can extract my exe code and alters my code to use in their own benefit.
My second question is actually regarding to the server and the database. The program has a default user for the mysql server that connects to the database (which only has execute privileges), and invokes the function. Is there a way to connect to a database with my program without actually including the database login & password & database name. Is there some way to do it like an asp page where I can just go to a webpage sending username and password for my program and that web page gives me the output string so that I can it in my program ( I can include a hidden web browser in my program).
please excuse me if my questions seem trivial but I am only a newbie and although I searched the forums and google, I could not find a straightforward answer. I have some ideas in my mind but if any of you have already been in my situation, then it would be a great help.
I will really appreciate any help
Thank you very much
andrew
|
|
|
|
|
Andrew,
Have a google for a obfuscator. Also, if you dont already, you could keep your username/passwords and any other important data encrypted, there are plenty of examples on google and here of how to do that.
Regards,
Gareth.
|
|
|
|
|
Hi,
I am basically trying to connect to a TomTom 520 and upload a new location/posistion. I have googled for stuff but whatever i google for TomTom, it just brings up places to buy it from.
Does anyone have any articles/info on if this is firstly possiable, and then how to do it.
Regards,
Gareth.
|
|
|
|
|
I'd imagine that you'd need some sort of official API from TomTom to do that, the closest thing that I could find is here[^]. If that doesn't help then your best recourse may be to email TomTom and ask them directly.
|
|
|
|
|
Hi Jimmanuel,
Thanks for the link. The SDK costs $195.00 and since this is a personal project, i think i'll just enter the locations with my fingers. Thanks for your help anyways!
Regards,
Gareth.
|
|
|
|
|
hi i use c# wpf blend
in my combobox..there are two content.. shown below..
what should i do when the project is execute.. the "Name" will be displayed straight in the combobox.. instead of blank
<br />
<ComboBox Visibility="visible" Margin="17,25,14,0" x:Name="contact_combobox" VerticalAlignment="Top" Height="24" IsSynchronizedWithCurrentItem="True"><br />
<ComboBoxItem Content="Name"/><br />
<ComboBoxItem Content="Email"/><br />
</ComboBox>
2nd question
how to change textbox color in code behind..
this.textboxEmail.BackColor=Color.Yellow;
i cant find the .backcolor in wpf
|
|
|
|
|
hi let me rephrase my question...
a combobox has 2 values..
name
email
when i run this project .. my problem is i don want to see
blank (first line)
name
email
i want to view it as
name
email
|
|
|
|
|
Hi!
Just set the SelectedIndex or SelectedItem property of the combobox to the desired value.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I get the following exception when I try to update my database It says:"Update requires a valid InsertCommand when passed DataRow collection with new rows."
and I dont know how to add the appropriated insert command.
Please help, thanks.
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Data.OleDb;<br />
using System.Data;<br />
<br />
namespace WindowsFormsApplication1<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=E:\\hp\\Source\\Val-Asr-LastPart\\db1.mdb");<br />
con.Open();<br />
string sqlstr = "SELECT * FROM kham";<br />
OleDbCommand com=new OleDbCommand(sqlstr,con);<br />
OleDbDataAdapter da =new OleDbDataAdapter(com);<br />
DataSet ds = new DataSet();<br />
da.Fill(ds, "kham");<br />
DataRowCollection drc = ds.Tables["kham"].Rows;<br />
textBox1.Text = (string)drc[0][1];<br />
<br />
<br />
string str1 = (string)drc[0][1];<br />
string st="";<br />
string stt="";<br />
char[] ch1 = str1.ToCharArray();<br />
int k=0;<br />
int i=0;<br />
<br />
<br />
sqlstr="SELECT * FROM parsed";<br />
com.CommandText=sqlstr;<br />
da=null;<br />
da=new OleDbDataAdapter(com);<br />
ds=null;<br />
ds=new DataSet();<br />
da.Fill(ds,"parsed");<br />
for (; i < ch1.Length; i++)<br />
{<br />
if ((ch1[i] == '1' || ch1[i] == '2' || ch1[i] == '3' || ch1[i] == '4' || ch1[i] == '5' || ch1[i] == '6' || ch1[i] == '7' || ch1[i] == '8' || ch1[i] == '9' || ch1[i] == '0') && (ch1[i + 1] == '?'))<br />
{<br />
for(i++;i<ch1.length;i++)><br />
if ((ch1[i]!='(')||(ch1[i+1]!='['))<br />
st += ch1[i];<br />
else<br />
{<br />
for (i += 6; i < ch1.Length; i++)<br />
if ((ch1[i] == '1' || ch1[i] == '2' || ch1[i] == '3' || ch1[i] == '4' || ch1[i] == '5' || ch1[i] == '6' || ch1[i] == '7' || ch1[i] == '8' || ch1[i] == '9' || ch1[i] == '0') && (ch1[i + 1] == '?'))<br />
{<br />
string[] sst = { ""+(k++), st, stt };<br />
ds.Tables["parsed"].Rows.Add(sst);<br />
stt = "";<br />
i--;<br />
break;<br />
}<br />
else<br />
stt += ch1[i];<br />
break;<br />
}<br />
}<br />
<br />
}<br />
da.Update(ds,"parsed");
}<br />
}<br />
}<br />
</ch1.length;i++)>
modified on Saturday, January 05, 2008 9:31:30 AM
|
|
|
|
|
This may be a hard question but i really wondered and needed. How can we make some certain wireless connections disappear from (winxp) existing wireless connections list. (for example i want to omit usr9600 connection). is this possible
|
|
|
|
|
i have two combobox one of them is dependent to the other, how can i let the content of the first one change whenever i choose an opition from the second combobox.
|
|
|
|
|
azza104 wrote: how can i let the content of the first one change whenever i choose an opition from the second combobox.
Write a handler for the first combobox's SelectionChangeCommited [^] event. In this handler, reset the contents of the second combobox.
/ravi
|
|
|
|
|
thanx for your reply, i used the SelectedChangeCommitted but i don't have an efficient result.
this is my code:
at the designer.cs file:
this.combo_origion.SelectionChangeCommitted += new System.EventHandler(this.c);
and at the code file:
private void c(object sender, EventArgs e)
{
ComboBox com = (ComboBox)sender;
string selectedItem = combo_origion.SelectedText;
fill_locations(selectedItem);
}
/***************** at the following method the second combobox should change its content whenever the first one change the selected item ****/
private void fill_locations(string s) {
string st = combo_origion.Text;
SqlDataAdapter dtp = new SqlDataAdapter("get_locations", conn);
dtp.SelectCommand.CommandType = CommandType.StoredProcedure;
dtp.SelectCommand.Parameters.Add("@type_text", SqlDbType.NVarChar).Value = s;
DataSet chds = new DataSet();
dtp.Fill(chds);
combo_locations.DataSource = chds.Tables[0].DefaultView;
combo_locations.DisplayMember = "location";
combo_locations.ValueMember = "location_id";
//combo_locations.DataBind();
}
|
|
|
|
|
i the previous method is true i fixed my database and its run now , but the changes happens after selecting the item two times...so do u know the problem here?
|
|
|
|
|
Can anyone recommend a good book for self learning C#?
I'm looking for something that is reasonably up to date and has plenty of programming exercises to stretch the brain. I like the Deitel books because they have good exercises, but they cost too much and weigh a ton.
A book that includes multimedia programming would be good but not essential.
Thanks
James
Melbourne
|
|
|
|
|
Personally I love this[^] book ... it doesn't really have any exercises but its a great foundation for learning C#.
It's currently in it's 4th edition having been updated each time for the various releases of C# and .Net and covers everything from your primative types to Linq
|
|
|
|