|
You asked this question previously and it was suggested to you to to alter the way you're casting the incoming values, yet here is the same code. Why are you using the MSCOMM control in C#? Shouldn't you be using the SerialPort class? Anyway, the runtime doesn't SKIP the code, it throws an OverflowException, did you actually attach the debugger and step the code?
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
is it possible to invisible 1 column in datalist?
|
|
|
|
|
DataList1.Items[0].Visible = false;
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hey Guys Need Help
I created a Console Application to send out mails. The method i used is adding reference of Using System.Web.mail
MailMessage mail = new MailMessage();
mail.To = "xxx@xxx.com";
mail.From = "xxx@xxxe.com";
mail.Cc = "";
mail.Subject = "Testing Console";
mail.BodyFormat = MailFormat.Html;
mail.Body = "Testing";
SmtpMail.SmtpServer = "xx.x.xx.xx";
SmtpMail.Send(mail);
But I gotten this error saying "The transport failed to connect to the server."
Then I used The System.Net.Mail
MailMessage message = new MailMessage();
message.From = new MailAddress("xxx@xxx.com");
message.To.Add(new MailAddress("xxx@xxx.com"));
message.CC.Add(new MailAddress("carboncopy@foo.bar.com"));
message.Subject = "This is my subject";
message.Body = "This is the content";
SmtpClient client = new SmtpClient("xx.x.xx.xx");
client.Send(message);
But I gotten this error saying "Failure sending mail.."
I am running out of ideas. Any solution or advise
Thanks A million
KaKaShi HaTaKe
|
|
|
|
|
HatakeKaKaShi wrote: Then I used The System.Net.Mail
This is the preferred way of sending mails from .Net 2.0 onwards.
HatakeKaKaShi wrote: But I gotten this error saying "Failure sending mail.."
Your priece of code looks ok.
What I can think of is that your SMTP server is either not accepting the mail or it is not there at all.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
hahahaha You are right bro....... I am all stress up over wrong IP
Anyway Thanks Man
KaKaShi HaTaKe
|
|
|
|
|
Hi,
I created a transparent Richtextbox control whose background color is transparent.
Since, .NET does not support transparent background color of RichTextbox we need to use the CreateParams of the Windows API.
I used the code below in order to make the RichTextBox transparent:
(reference: http://www.dotnetjunkies.com/WebLog/johnwood/archive/2006/07/04/transparent_richtextbox.aspx)
public class RichEdit50 : RichTextBox
{
[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
static extern IntPtr LoadLibrary(string lpFileName);
protected override CreateParams CreateParams
{
get
{
CreateParams prams = base.CreateParams;
if (LoadLibrary("msftedit.dll")!=IntPtr.Zero)
{
prams.ExStyle |= 0x020; // transparent
prams.ClassName = "RICHEDIT50W";
}
return prams;
}
}
}
Actually I have a usercontrol, over which I placed this RichTextbox .
I have made the Richtextbox transparent by using the RichEdit50 class.
Now, i set the background color of the user control to transparent. But, the problem is that whenever i put some text on the Richtextbox control which is transparent, the text disappears if i hover the mouse anywhere on the screen.I guess, since the control now is set to Transparent background, everything including the text on the control is disappearing.
I am not sure how to retain the text on the Richtextbox.
Any help will be appreciated.
Thanks and Regards,
Deb
|
|
|
|
|
If you do something unsupported, expect issues, else they would have made it available. Personally, I would not supply a custom class name as you have done.
|
|
|
|
|
Hi,
By using the above code which I have mentioned I am able to get the Transparency od the RichTextbox control, but the problem is that the text is not somehow being able to retain on the control.
The text on the Richtextbox suddenly gets disappear when i hover the mouse on the screen.
Can someone help me out on this problem.
Thanks and Regards,
Deb
|
|
|
|
|
Hi,
I am using the following code to get the installed printers on the local machine.
During the loop, when it gets to one of the printers, it throws an error which is invalid parameter. I can not figure out what is wrong.
Error happens on the foreach line.
I do not see any difference between the printer that seems to throw the error and all the other printers.
Any thoughts please?
This is the code:
using System.Management;
...
string strServer = "\\\\" + txtServerName.Text.Trim();
ManagementScope myScope = new ManagementScope(strServer + "\\root\\cimv2");
SelectQuery oQuery = new SelectQuery("SELECT * FROM WIN32_Printer");
ManagementObjectSearcher oResults = new ManagementObjectSearcher(myScope, oQuery);
//Iterate through printers...
foreach (ManagementObject oItem in oResults.Get())
{
string strPrinterName = oItem.Properties["DeviceID"].Value.ToString();
}
|
|
|
|
|
I am developing a rent a car software. The customer is limited to 150mile daily and he should pay US35 for every 10miles extra.
How can I calculate that on the day customer returns the vehicle?
|
|
|
|
|
This is C# form and not a primary school maths class
jrahma wrote: How can I calculate that on the day customer returns the vehicle?
float LfExtraMilage = (LfEndMilage - LfStartMilage) - (150 * (LiNumberOfDays + 1));
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
float distance = 215;
float overhead = distance - 150;
if(overhead > 0)
{
float extraMiles = (int)(overhead / 10) + Math.Sign(overhead % 10);
float price = 35 * extraMiles;
}
This assumes 35$ for each 10 miles and another 35$ for each new incomplete ten miles started.
By the way, this is really like 5th grade maths
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
var fee = Math.Max(mileage - 150,0) * 35;
|
|
|
|
|
jrahma wrote: I am developing a rent a car software.
Well, judging by this and your previous post I hope your client has low expectations and a lot of time allocated for testing.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I am developing a rent a car software and if the customer didn't return the car on the time as per the contract then he has to pay US10 for every one hour after the agreed time.
how can i calculate how many (one hours) he has to pay?
|
|
|
|
|
jrahma wrote: how can i calculate how many (one hours) he has to pay?
This is no programming question.
You better have a look at RentACoder[^]
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
|
Hi ! I am designing a simple calculator application and I am having trouble coding the backspace button. I store the data that the user had input in a string by the name of strInput with initial value strInput = "" .
I display the value that the user had clicked by coding :
lblDisplayPanel.Text+="value of button";
For example, lets take a look at my button 1
private void btn1_Click(object sender, EventArgs e)
{
lblDisplayPanel.Text += "1";
}
so when I click button 1 thrice, the display panel will show "111". However, I only know how to add values to the display panel label. I tried -= but it wont work .
The backspace button is supposed to remove the last value entered by the user but how do I do that ?
|
|
|
|
|
Try the following in your back space button click event
private void btnBS_Click(object sender, EventArgs e)
{
lblDisplayPanel.Text = lblDisplayPanel.Text.Remove(lblDisplayPanel.Text.Lemgth - 1);
}
|
|
|
|
|
Thanks. I read the description of the remove method from the intellisense and it explains alot.
|
|
|
|
|
Lim Yuxuan wrote: The backspace button is supposed to remove the last value entered by the user but how do I do that ?
lblDisplayPanel.Text = lblDisplayPanel.Text.Remove(lblDisplayPanel.Text.Length - 1, 1);
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Thanks. I have read the description of the remove method from the intellisense and it explains alot.
|
|
|
|
|
Hi.
I'm building an application in winform environment that have a Tabcontrol in it.
That tabcontrol should have multiple lines in it.This can be done by setting the multiline property in the control.
But what i have trouble in is ordering the tabpaged in the control in a custom order.
for example , i want the first row to have 4 tabpages, second row 10 tabpages and so on....
can i accomplish that task without altering the tabpages width that causes
the tabpages to slide off to the next row?
thanks
|
|
|
|
|
I have this code written to create a button at runtime, inspite of setting the text assign , the text is not visible on the button. Please help me.
DataGridViewButtonColumn objAssign;
objAssign = new DataGridViewButtonColumn();
objAssign.Name = "Assign";
objAssign.Text = "Assign";
objAssign.HeaderText = "Assign";
objAssign.ToolTipText = "Click to Assign";
dtgAssignIssues.Columns.Add(objAssign);
Then, I tried looping through the buttons using the following code, it sets the text for the button only if there is one row. could u plz help me for multiple rows.
DataGridViewButtonColumn objAssign;
objAssign = new DataGridViewButtonColumn();
objAssign.HeaderText = "Assign";
objAssign.Name = "Assign";
dtgAssignIssues.Columns.Add(objAssign);
//dtgAssignIssues.Columns[1].ReadOnly = false;
foreach (DataGridViewRow r in dtgAssignIssues.Rows)
{
//MessageBox.Show(objAssign.Index.ToString());
DataGridViewButtonCell b;
b = (DataGridViewButtonCell)r.Cells["Assign"];
b.Value = "Assign";
}
|
|
|
|