|
I take it you don't teach English grammer
He's a very naughty boy
Blog Have I http:\\www.frankkerrigan.com
|
|
|
|
|
mr kerrigan
you inslut the good and freindly professor ulhas? do you want, are you asking, for summoning of cursings of shiva on you?! i hope not so. maybe you bring the cheatingers on cpian internetp ages with u consexquences.
Sincelery yours, Computer Information conSciences Professor and grader, Sharada Ulhas
|
|
|
|
|
hi,
I have a datagridview on windows app(.net 2.0). I wanted to provide user with flexibility of changing any cell values within datagridView. In doing so, i wanted to check if datatype of the cell gets validated. When user updates the value within the datagridView, I want to check the OLD DATATYPE and NEW DATATYPE of the data. Meaning, I want to know beforehand what datatype the column allows and what datatype is the text user typing in.
I tried this:
object gridCellValue;
void repriceQuedataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
gridCellValue = repriceQuedataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
}
void repriceQuedataGridView1_CellParsing(object sender, DataGridViewCellParsingEventArgs e)
{
Type sourceType = e.ColumnIndex.GetType();
Type changedDataType = e.Value.GetType();
Console.WriteLine(sender.GetType().ToString());
if (!sourceType.Equals(changedDataType))
{
MessageBox.Show("Please try again. Expected type is: " + e.ColumnIndex.GetType().ToString());
e.Value = gridCellValue;
e.ParsingApplied = true;
}
}
However,
Type changedDataType = e.Value.GetType(); line always gets datatype string because e.value is string. I want to check if lets say the original column allows int then the new value that user enters is of type int.
I want to write these events in such a way that it is GENERIC FOR ANY DATATYPE.
Please shed some light.
Thanks
Needy
|
|
|
|
|
Here is one approach:
void repriceQuedataGridView1_CellParsing(object sender,
DataGridViewCellParsingEventArgs e)
{
try
{
object convertedValue = Convert.ChangeType(e.Value, e.DesiredType);
}
catch
{
MessageBox.Show("Please try again. Expected type is " +
e.DesiredType.ToString());
DataGridView gridView = (DataGridView)sender;
if (Convert.IsDBNull(gridView.CurrentCell.Value))
{
gridView.CurrentCell.Value = string.Empty;
}
e.Value = gridView.CurrentCell.Value;
e.ParsingApplied = true;
}
}
Hope this helps.
|
|
|
|
|
Thank you Lisa. I will post if any problem occurs.
I appreciate your help.
Thanks
Needy
|
|
|
|
|
I have a Form from which a button click will open another form. Is there a way I can control the exact location of the second form on the screen (where the window will be displayed).
|
|
|
|
|
Yes. Pass the coordinates in the form's custom constructor and set the form's Location property in its Loaded event.
/ravi
|
|
|
|
|
Set the initial location property so that it's not predetermined, then set the values before calling the ShowDialog method.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Guys..
I want to try make GIS project for seraching shortest path. I want to try C#. Anybody can help from where should i start?
Thanks.
|
|
|
|
|
Shortest path? That's what the van Dijkstra and A* algorithms are for.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
You might want to look up the "Travelling Salesman Algorithm"
|
|
|
|
|
I have a textbox control with the Multiline property set to true. I want the color of every other line to change. (ie. Yellow White Yellow White etc.) Below is what I tried. This sets the entire text to Yellow. Is there any other way?
for ( int i=0; i < arrlLog.Count; i++ )
{
if ( i % 2 == 0 )
{
txtLog.ForeColor = Color.Yellow;
}
else
{
txtLog.ForeColor = Color.White; }
txtLog.Text += arrlLog[i];
txtLog.Text += "\r\n";
}
|
|
|
|
|
You'll either have to render the TextBox control yourself (referred to as "ownerdraw") or use a different control that offers better flexibility, like the ListView or DataGridView. The standard TextBox control doesn't support the functionality you want.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
It would work, so long as you don't change the size of the RTB with the form, 'cause the white and yellow formatting will follow the flow of the text, not the lines in the box.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
The connection string for SQL Server 2005 Express version is something like:
Trusted_Connection=yes;Server=[ip]\SQLEXPRESS;Database=[database];user=[user];password=[pw];
But how about the one for SQL Server 2000?
Thanks!
|
|
|
|
|
I am using SqlConnection and SqlDataAdapter.
Please Help! Thanks!
|
|
|
|
|
Specifying a trusted connection and a user name and password is pointless. Choose one or the other. If I remember correctly, if you put both, it will go for a trusted connection.
Archyami wrote: But how about the one for SQL Server 2000?
Same deal - But you cannot specify files directly. They must already be attached to the server.
|
|
|
|
|
I have an XML file that may go upto 1GB and may contaion 5 lakh records. I wanted to retrieve last or latest 3000 records. I was trying to use XmlTextReader, but was a fail.
Is there any way by which i can read from end of a XML file and get all the details taking into account of performance.
Thanks in advance
Praveen Raghuvanshi
Software Engineer,
|
|
|
|
|
Use xPath, it's the quickest method of reading xml. However if you only need the latest 3000 records, i'd recommend creating a temp-file like construction in order to read the required data only.
|
|
|
|
|
Thanks Eduard for your reply.....
could you please elaborate or send me a link for xPath and the other solution described by you.
Also, how i will be reading the find from end....
Praveen Raghuvanshi
Software Engineer
|
|
|
|
|
xPath is supported by the .NET framework in the namespace System.XML.XPath. You can find loads of manuals, how-to's and articles around the web.
I love it when a plan comes together
|
|
|
|
|
Hi guys,
Please help!!! this issue is driving me crazy. I have a crystal report which during creation I used an Oledb connection with SQL server 2000 to fetch the tables. In my C# code I am passing dbname, server, id and pwd to another server and I am getting a problem because I believe the report is trying to look for the OLEDB settings that I had used during the report creation.... I don't know if I am making any sense, here is my code.
try
{
bool rt=true;
string sErrMessage=string.Empty;
DBUtilObj obj = null;
obj=new DBUtilObj();
rt=obj.g_sGetConnectString(out m_sCnn, out m_sServer, out m_sDBName, out m_sUserId, out m_sPassword,out sErrMessage);
cryShared.TableLogOnInfo tbLogInfo=null;
Pinn rpt = new Pinn();
foreach ( cryEngine.Table tb in rpt.Database.Tables)
{
tbLogInfo=tb.LogOnInfo;
tbLogInfo.ConnectionInfo.ServerName=m_sServer;
tbLogInfo.ConnectionInfo.DatabaseName=m_sDBName;
tbLogInfo.ConnectionInfo.UserID=m_sUserId;
tbLogInfo.ConnectionInfo.Password=m_sPassword;
tb.ApplyLogOnInfo(tbLogInfo);
tb.Location="\"" + m_sDBName+".dbo.\"" +
tb.Location.Substring(tb.Location.LastIndexOf(".")+1);
}
crystalReportViewer1.ReportSource=rpt;
}
catch(Exception ex)
{
MessageBox.Show(this, ex.Message,"SelecSoftware Pinnacle+™",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
finally
{
}
Please help!!!!!!!!!!
sasa
|
|
|
|
|
Hello,
I would like to make a call to a web service at regular intervals and I'm interested in opinions on how best to do it.
My web service will need to read in some data from a database and move it to another application. This needs to happen for one case every 10 minutes, another case every hour and another case every 24 hours.
The easiest method I think is to use the built-in Windows Task Scheduler service as I've read somewhere that a Windows service would probably be overkill for what I want to do - the web service can report success if it is called so there's no need to audit the Windows Task Scheduler (I understand that there are potential problems with relying on the WTS to report errors).
The WTS seems a bit of a poor cousin of UNIX/Linux's cron. I wonder why MS has never bothered turning it into something actually useful?
So, can anyone tell me how to:
1. Add a job to the WTS which will call a web service (how do I call a web service on the command line)?
2. Implement something better - can I implement something in the web service itself or should I just write a separate service for each process that needs to call my service.
Thanks
|
|
|
|