Saturday, June 26, 2010
Mutisoft Extreme Software Development company in Sri Lanka
Web : www.multisoftextreme.com
E-mail : info@multisoftextreme.com
Tel : +94 (0) 772201066
Sunday, March 14, 2010
Ms Word Automation using C#, Filling a shape with a specific RGB values.
The RGB(51,102,153) is close to a blue color, but the colors we got close to blue are WdColor.wdColorLightBlue which has RGB(51,102,255) and WdColor.wdColorBlue which has RGB(0,0,255). Above those colors were presets and we found it hard to set it to the color of RGB(51,102,153).
Finally we found the solution, It was creating the color RGB(51,102,153) from the preset colors WdColor.wdColorLightBlue and WdColor.wdColorBlue. It is like mixing color and creating a new color.
The amazing thing in computers is you can subtract colors, This is how we created RGB(51,102,153).
WdColor.wdColorLightBlue -WdColor.wdColorBlue*2/5 which means
RGB(51,102,255) – RGB(0,0,255)*2/5
= RGB(51, 102,255 – 255*2/5)
=RGB(51,102,153)
So finally we were able to get the color we wanted by subtracting two colors
Friday, February 12, 2010
"Input string was not in a correct format" - Exception when Parsing strings to float, double
The problem was in Sri Lanka we use dot(.) as the decimal symbol and in Monaco France they use comma(,) as the decimal symbol, we had a text box to show their tax rate as 5.5, When parsing this 5.5 string to float or double both float.Parse() and float.TryParse() methods throws a exception saying “Input string was not in a correct format”
We Multisoft Extreme was able to successfully solve that problem by changing the decimal symbol from dot(.) to comma(,) in every occurrence of the application and changing 5.5 to 5,5. Also most importantly changing our current format to French (Monaco) from the Regional and Language Options form the control panel.
Saturday, February 6, 2010
MySQL Service Not starting - "Could not connect to the Service Control Manager.Error:0"
At the end of the installation the MySQL service did not start. The Error was "Could not connect to the Service Control Manager.Error:0"
The Client was using the machine of Windos 7 and unaware of whether they are using an Administrative account or not. They said they can install other softwares with out a problem.
Finally we were able to find the solution, The solution was running the installation setup as a administrator by right clicking on the setup and and selecting Run as Administrator. Also we asked our client to uninstall the current installation and delete the MySQL folder in the C:\Program Files
Then the service was started sucessfuly and the installation was a sucess.
Thursday, August 13, 2009
Windows media player end of stream problem
In here we used the “PlayStateChange” event of the media player in order to detect the end of stream.
bool isMediaEnded = false;
private void mPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
if (mPlayer.playState == WMPLib.WMPPlayState.wmppsMediaEnded)
{
isMediaEnded = true;
}
else if (mPlayer.playState == WMPLib.WMPPlayState.wmppsTransitioning)
{
if (isMediaEnded)
{
isMediaEnded = false;
// End of stream occurs here. Do what ever you want.
}
}
}
Monday, April 27, 2009
How to use the “ErrorProvider” control in a C# application
Add a label with the name ‘label1’, a textbox with the name ‘txtText’ and a button with the name ‘btnValidate’ as given in the above form. Also add error provider control to the form with the name ‘errorProvider’. Rename the Form as ‘FormTextBoxValidator’.
Then add this method to the FormTextBoxValidator.cs to validate the textbox.
private bool textBoxValidate()
{
errorProvider.Clear();
if (txtText.Text.Trim() == "")
{
errorProvider.SetError(txtText, "Text should be non empty");
return false;
}
return true;
}
Then to the click event of the ‘ btnValidate’ add the following code.
private void btnValidate_Click(object sender, EventArgs e)
{
if (textBoxValidate())
{
MessageBox.Show("Content validated!");
}
}
When you run the application, and click the validate button without entering a text to the textbox, it will provide an error as follows.
If you enter some text to the textbox, it will validate the textbox.