|
Hello everyone
Hope you all well. So I am a newbie to the world of programming and I am loving it of course - who wouldnt!
I wonder if anyone out there can help me with app that i would like to write for myself in C#. I work with a lot of emails, and I need to respons to the clients via emails and projects that need be completed. (I know there stuff you could buy for this but hey why be a programmer and buy??)
Anyway I just need some advice and a push in the rigt drection how to do it, so here goes:
Basic start up app, gives me completed tasks for the week, and those that I should try to get to today. Those I didnt finish of I can click a button and send a 'sorry' email to the client. I would like the app to pop up on starting up - no excuses of oops forgot to open my outlook. I tend to do that... :/
Anyway love the site and hope to be as brilliant as all of you in the near future!
Live Brave!
|
|
|
|
|
geoNeo_ wrote: So I am a newbie to the world of programming
How much so? because you may want to start somewhere more basic. But you will want to look at some of the following
Databases
DataGridView or simliar control
Event Handlers
Notification Icons
Timers
And some sort of email API or you can talk to outlook yourself
etc...
geoNeo_ wrote: Those I didnt finish of I can click a button and send a 'sorry' email to the client
I assume you dont rely on recommendations or repeat business to keep your job going then
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hey
Well newish - all the components I understand and more less how to use them, what I sort of dont really know is what commands to use or how actually go about it.
I mean for example wat units to use, how the I/O is utlised or joined onto the local machines email program stuff like that.
Thanks for your prompt reply, is just something I really like to take on as my firts full fledged app.
Your help is greatly appreciated
|
|
|
|
|
Hi All,
I'm trying to chenge the color of my ProgressBar without building a new component from scratch.
I tried inheriting from System.Windows.Forms.ProgressBar and use the code below (which I found in several forums), but it's not working (if relevant, I'm working on vista 64).
Any ideas?
class MyProgressBar : ProgressBar
{
[DllImport("User32.Dll")]
public static extern int SendMessage(int hwnd, int wMsg, int wParam, int lParam);
public const int PBM_SETBKCOLOR = 0x2001;
public const int PBM_SETBARCOLOR = 0x409;
public void SetProgressBackColor(Color c)
{ int a = Convert.ToInt32(c.R.ToString());
int b = Convert.ToInt32(c.G.ToString());
int d = Convert.ToInt32(c.B.ToString());
int tot = Convert.ToInt32(ColorTranslator.ToOle(Color.FromArgb(a, b, d)).ToString());
int j = this.Handle.ToInt32();
SendMessage(j, PBM_SETBKCOLOR, 0, tot);
}
public void SetProgressForeColor(Color c)
{ int a = Convert.ToInt32(c.R.ToString());
int b = Convert.ToInt32(c.G.ToString());
int d = Convert.ToInt32(c.B.ToString());
int tot = Convert.ToInt32(ColorTranslator.ToOle(Color.FromArgb(a, b, d)).ToString());
int j = this.Handle.ToInt32();
SendMessage(j, PBM_SETBARCOLOR, 0, tot);
}
}
Thanks!
|
|
|
|
|
eyalbi007 wrote: int a = Convert.ToInt32(c.R.ToString());
Seriously, why would you do that? Its effect is equivalent to that of int a = c.R; , but a lot slower.
Oh and your SendMessage signature is incorrect.
Use:
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
static extern IntPtr SendMessage(IntPtr hWnd, Int32 Msg, IntPtr wParam, IntPtr lParam);
|
|
|
|
|
I think this would be the best option...
int a = (int)Double.Parse(Convert.ToInt32(c.R.ToString())).ToString();
... Actually that mind need a little work still (wheres the 'ive wet myself with laughter' smiley???)
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Give me a break, it's just a code I copied fom the web...
|
|
|
|
|
Well, change it..
It needs to be changed anyhow, because of the required IntPtr's. They are actually required here because you trying to run it in 64 bit mode which is expecting 64 bit arguments and you're passing 32 bit ones.
I wouldn't trust such badly written code at all
|
|
|
|
|
Well, still not working...
|
|
|
|
|
Well, show us the codez.. and tell us what it's doing (if anything)
|
|
|
|
|
Here's the code (that indeed does nothing).
What I was hopint it'll do is paint the prorgesss bar in different color than green (the Windows default color), by pressing button2. button1 simply advances the bar.
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
public const Int32 PBM_SETBKCOLOR = 0x2001;
public const Int32 PBM_SETBARCOLOR = 0x0409;
public void SetProgressBackColor(Color c)
{ int a = c.R;
int b = c.G;
int d = c.B;
int tot = ColorTranslator.ToOle(Color.FromArgb(a, b, d));
IntPtr j = this.progressBar1.Handle;
SendMessage(j, PBM_SETBKCOLOR, 0, tot);
}
public void SetProgressForeColor(Color c)
{ int a = c.R;
int b = c.G;
int d = c.B;
int tot = ColorTranslator.ToOle(Color.FromArgb(a, b, d));
IntPtr j = this.progressBar1.Handle;
SendMessage(j, PBM_SETBKCOLOR, 0, tot);
}
private void button1_Click(object sender, EventArgs e)
{
this.progressBar1.Minimum = 1;
this.progressBar1.Maximum = 10000;
this.progressBar1.Step = 1;
this.progressBar1.Value = 1;
for (int i = progressBar1.Minimum; i <= progressBar1.Maximum; i++)
{
progressBar1.PerformStep();
}
}
private void button2_Click(object sender, EventArgs e)
{
SetProgressBackColor(System.Drawing.Color.BlueViolet);
SetProgressForeColor(System.Drawing.Color.Red);
}
|
|
|
|
|
Well for one thing, the SendMessage signature still isn't correct. You absolutely have to use those annoying IntPtr's otherwise it won't work.
But then there's something else, I once heard (not sure how true it is) that progress bars in Vista may only be green yellow or red and that they have a special (different) message to change it. May be worth investigating.
|
|
|
|
|
Just make your own control, you can prob do in less code then you using to change it lol
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
eyalbi007 wrote: int j = this.Handle.ToInt32();
wrong
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hello,
I am working on window application and i want to assign multicolor to text through programming,
I am filling data in Rich Text box and i want to assign different color to text like. word "Hello" in red word "Welcome" in blue etc.
I am working on C# kindly tell me what should i do and how this problem can be solve easily.
Thanks
|
|
|
|
|
Create one string array and in that array set all words,and give color to each item of array and finally convert all array items in single line string.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
U need to use the selectedText and selectionColor properties of the Richtextbox.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Hi
I have some problem while getting common data from two tables.
I have one dataset which contains tow datatables, one datatable contains 100 rows and second datatable contains 10 rows, both having one common field (example: currentdate), now i want matching rows from both table in one single table. how can i do it. please give me some example also.
Thank you
|
|
|
|
|
create a relation between the two tables?
|
|
|
|
|
hi...
i have used datarelation but i am not sure how to get that common data into one single table...can you give me some code for that.
Thank You.
|
|
|
|
|
I guess the straight forward way would be to loop through one table and for each row copy its data and all the related rows into the new table.
|
|
|
|
|
I get http://www.postimage.org/image.php?v=Pq1N1qmr[^] <- this error on one of the computers.
Dont know why.
this is the code:
try
{
label12.ForeColor = Color.Black;
string dbConnComm = "INSERT INTO Vnosi ([Dostava],[Skatla],[Barkoda],[Oznaka],[Skener],[Operater],[Datum],[PosnetkiV3],[PosnetkiM3],[Opombe]) VALUES ("
+ cmbDostava.Text + ", "
+ cmbSkatla.Text + ", '"
+ cmbBarkoda.Text + "', '"
+ cmbEnota.Text + "', '"
+ cmbSkener.Text + "', '"
+ cmbOperater.Text + "', '"
+ cmbDatum.Text + "', "
+ txtVA3.Text + ", "
+ txtMA3.Text + ", '"
+ txtOpombe.Text + "')";
SqlConnection dbConn = new SqlConnection(sqlConnection);
dbConn.Open();
SqlCommand dbComm = new SqlCommand(dbConnComm, dbConn);
dbComm.ExecuteNonQuery();
dbConn.Close();
label12.Text = "Uspešno vnešeno";
}
catch(Exception ex)
{
label12.ForeColor = Color.Red;
label12.Text = "Napaka pri vnosu";
MessageBox.Show("Napaka: " + ex.ToString());
}
PC has framework 2.0 and 1.1
|
|
|
|
|
A few quick question to help try find the answer.
Have you tried the insert into the database directly and dose it work?
What is the connection string you are using as it appears to be a connection issue?
Can you connect to the database from that machine?
Why are you using an insert? you should look at using a stored procedure as direct sql asks for an injection attack.
|
|
|
|
|
|
Yes Giorgi, thank you for your information on security about SQL injections.
I just needed an anwser which was more than funny. The SQL Connection string was wrong.
And its my bad that i forgot to mention that this error occurs only on computers which have low-access accounts in our domain. Now i've fixed this and it works.
HopingToCode was right. I should check the connection string. Which i did today.
Thank you both for your time.
Regards,
Matjaž
|
|
|
|