|
|
you might also want to put it inside a try block also in case it cant be converted.
the Char class has an isNumber to determine if thier all numbers.
I'm sure theres a better way of doing it though
Maybe even better would be to extend the Double if its not final
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
i have a search form which has (text boxes )firstname, lastname, phone, (button) search
i would like to be able to press Enter in any textbox and have the "Search" button clicked.
any tips on how to make this happen?
that is my primary objective .. i also can not find how to make the carrot focus on a text field when the form is called, or after the "search" button is submitted.
any insight on either of these would be much appreciated. thanks!
|
|
|
|
|
Make "search button" Accept button of the form
Regarding to second question..
if focus was on the textbox when you started search, it should be returned on textbox automatically when search is finished.
"...hasn't really been well accepted ... as the ratings tell us so far " - Nishant S
|
|
|
|
|
I am currently involved in a project that is a distrubeted network for sharing medical teaching cases between hospitals. It operates kind of like a specialized kazaa. The current system is in beta. It uses java servlets to send custom HTML messages between the querying program and the stroage server. I thought that it could be better implemented using a web service. Firstly the implementation would be more elegant from a programming stand point. Second, web services are a good technology base for future work. They are full featured and the functionality is constantly being expanded. The engineer in charge of the project has no knowledge of SOAP at all and he has been resistant to my ideas. He does report to a committee that overseas the project. What would be the best way to convice people that the project should use web services? I need more than the fact that it is cooler and technologically superior. Thanks.
Steve
Not all who wander are lost...
|
|
|
|
|
Steve Severance wrote:
What would be the best way to convice people that the project should use web services? I need more than the fact that it is cooler and technologically superior. Thanks.
The cool thing about web services is that they don't need to be the only API you provide to your system. You can also provide alternative solutions, like traditional (simpler) socket APIs, and so on.
If you're stuck with pure C on an old UNIX machines, SOAP messages can be hard to hand-code.
Therefore, my advice is: provide alternative implementations to ease access from older technologies, and make those alternative APIs consistent with the Web Service. When the time comes, almost everyone will migrate to the most efficient technology.
while (!sorted)
;
|
|
|
|
|
web services aren't just only to SOAP.
You can transport via HTTP and FTP
The good thing about web services is any language can tie into them using DISCO and hook to a wsdl.
But there a huge security risk, hackers can easily get past firewalls since firewalls dont guard agains web services. tpyically though becuase I heard some are sifting for unusual data.
But send jsp http requests to update data seems kind of old-world since web services are easier and less code means easier maintainable. Which in your employers eyes means more product for less money. If you want it to fly the keyword is "real world experiences saving MONEY"
do some research and make a 3 page report.
but youll create an enemny. be forwarned.
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
how to read worksheet with C#
someone can help me to write this code
Thanks!!
Nho'c Ti`
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07172003.asp[^]
is pretty good - tells you how to install the PIA.
however you can simplyfy the code to:
using Excel;
using Microsoft.Office.Core;
using System.Reflection;
namespace whaterever
{
class ExcelToWhatever
{
Excel.Application _excel = null;
[STAThread]
static void Main(string[] args)
{
ExcelToWhatever app = new ExcelToWhatever();
}
public ExcelToWhatever()
{
_excel = new Excel.ApplicationClass();
_excel.Visible = true;
try
{
Process();
}
finally
{
_excel.Quit();
}
}
void Process()
{
Workbook workbook = _excel.Workbooks.Open(@"whatever.xls",
Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,
Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value,Missing.Value);
ProcessSheet((Worksheet)workbook.Worksheets["sheet1"]);
}
void ProcessSheet(Worksheet worksheet)
{
Range aCell = (Range)worksheet.Cells[1, 2];
string cellText = aCell .Value2.ToString().Trim();
}
}
}
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
You can also use ADO.NET (or legacy ADO) to access the excel worksheet as a data source.
MSDN Reference, which uses legacy ADO: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnasdj01/html/asp0193.asp[^]
The following is a quick and ugly snipit, using ADO.NET to access the Excel 2000 file "Test.xls" and retrieve the worksheet "Test" as a data table.
<br> System.Data.OleDb.OleDbConnection con = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Test.xls;Extended Properties=Excel 8.0;");<br><br> System.Data.OleDb.OleDbDataAdapter adapt = new System.Data.OleDb.OleDbDataAdapter("Select * from [Test$]",con);<br> <br> System.Data.DataTable dtab = new System.Data.DataTable();<br> <br> con.Open();<br> adapt.Fill(dtab);<br> <br> // Row 1 is misread into Column Headers.... retrieve by dtab.Columns[0].Caption;<br> <br> // The following will show row 1, column 4.<br><br> MessageBox.Show(dtab.Columns[3].ToString());<br> <br> // Each row is accessed as follows... this is for row 5, column 4.<br> <br> MessageBox.Show(dtab.Rows[4].ItemArray[3].ToString());<br>
Hope that helps a bit.
--Jesse
|
|
|
|
|
I gave smaple code about 7 or 8 days ago to someone that takes a worksheet and ports it to a DataTable check it out
http://www.codeproject.com/script/comments/forums.asp?forumid=1649&fr=676#xx561850xx
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
There is a lot of Excel samples, but I would like to contribute some functions that will help you work with excel.
public string ConvertExcelIndexToLetter( int column ) {
System.Text.StringBuilder value = new System.Text.StringBuilder();
const int BASE_VALUE = 26;
int modularBase;
while ( column != 0 ) {
if( column == ( ( column / BASE_VALUE ) * BASE_VALUE ) ) {
modularBase = column - ( ( column / BASE_VALUE ) - 1 ) * BASE_VALUE;
column = ( column / BASE_VALUE ) - 1;
}
else {
modularBase = column - ( ( column / BASE_VALUE ) ) * BASE_VALUE;
column = ( column / BASE_VALUE );
}
value.Append( ((char)( modularBase + 64 )).ToString() );
}
return value.ToString();
}
private void NAR(object o){
try {
System.Runtime.InteropServices.Marshal.ReleaseComObject(o);
}
catch{ }
finally{
if (o != null ) o = null;
}
}
|
|
|
|
|
Dear all,
I am developing a desktop application in c# with sqlserver2000, presently my application is doing following steps to communicate with database.
1. Open the connection
2. Create a command
3. Define the input parameter
3. ExecuteNonQuery
4. Assign new values to input parameters
5. ExecuteNonQuery
6 Close Connection
I need help in this regard, is this best practise regarding desktop applications or not.
what about below option?
that i build sql connection and put it in some public object in some class and next time use this global connection object.
infact i would like to imporve my application speed.
Thanks and regards
Muhammad Sarfraz
|
|
|
|
|
I prefer the scenario you described. Just because you benefits from framework built-in connection pooling. You don't need global objects, but remeber for each openning connection you MUST provide the same connection string (means equality of content).
For more (and better described;P) details see MSDN documentation or online
http://msdn.microsoft.com/vstudio/using/understand/data/default.aspx?pull=/library/en-us/dnadonet/html/adonetbest.asp[^]
Tomas Rampas
------------------------------
gedas CR s.r.o.
System analyst, MCP
TGM 840,
293 01 Mlada Boleslav,
Czech Republic
Telefon/phone +420(326)711411
Telefax/fax +420(326)711420
rampas@gedas.cz
http://www.gedas.com/
------------------------------
To be or not to be is true...
George Bool
|
|
|
|
|
dear Tomas Rampas thanks for help
my first option in which i open and close connection, i feel would be slow because each time i am opening connection for same sort of things.
i have heard from some where that open and close connection is best for web applications and where as for desktop applications you can hold connection object at application level. What u say, i am yet confused(
thanks again for help .
Muhammad Sarfraz
|
|
|
|
|
Hello Gurus,
I use public/shared connection at Form level for my desktop application. Especially, when you frequently create and destroy connections, performance woud be improved dramatically.
One note: you have to close an OleDbDataReader before it lets you reusing the same connection.
Khang Nguyen
|
|
|
|
|
Is there a simple method within the .NET framework to check for Internet network access without it popping up a dialer box for those with dial up?
I want to make notification application that runs in the background and checks for notifcations every 15 minutes or so, when they are connected. If there are not connected it will sit idle waiting until they do.
Any ideas?
Rocky Moore <><
|
|
|
|
|
No there is not, fortunately you could use interop and InternetGetConnectedState Win32API function.
(code adopted from someone within MS)
<br />
bool IsConnecting;<br />
<br />
[DllImport("wininet.dll", SetLastError=true)]<br />
private static extern bool InternetGetConnectedState(ref UInt32 Flags, <br />
UInt32 Reserved);<br />
<br />
private void buttonStartMonitor_Click(object sender, System.EventArgs e)<br />
{<br />
UInt32 Flags = new UInt32();<br />
IsConnecting = InternetGetConnectedState(ref Flags,0);<br />
timer1.Interval = 100;<br />
timer1.Start();<br />
}<br />
<br />
private void timer1_Tick(object sender, System.EventArgs e)<br />
{<br />
UInt32 Flags = new UInt32();<br />
if(IsConnecting != InternetGetConnectedState(ref Flags,0))<br />
{<br />
IsConnecting = InternetGetConnectedState(ref Flags,0);<br />
}<br />
}<br />
Tomas Rampas
------------------------------
gedas CR s.r.o.
System analyst, MCP
TGM 840,
293 01 Mlada Boleslav,
Czech Republic
Telefon/phone +420(326)711411
Telefax/fax +420(326)711420
rampas@gedas.cz
http://www.gedas.com/
------------------------------
To be or not to be is true...
George Bool
|
|
|
|
|
Thanks, I knew the Win32 method, just looking for a .NET only solution.
Rocky Moore <><
|
|
|
|
|
Yeah, you'd think there would be one, especially with .NET's emphasis on the internet. But the WinAPI way is not hard at all.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
jdunlap wrote:
Yeah, you'd think there would be one, especially with .NET's emphasis on the internet.
Yeah, you would think so, but I just remember this is only version 1. I figure they will get it in there within the next version or two.
jdunlap wrote:
But the WinAPI way is not hard at all.
No, not hard, just not portable. I hate to rely on Win32 calls unless there is absolutely no other way and the feature must be supported. I would rather not implement some features if it requires going to Win32. It is not that .NET works on many different platforms yet, but I do not want to go back and make all kinds of changes in the future if at all possible. I know one day the code will be going cross platform and want to be prepared.
This next winter I plan to invest some time into the Mono/Linux platform and see just how much can make it with with they have at the time. You never know when Home Land Security will label Windows a virus
Rocky Moore <><
|
|
|
|
|
Rocky Moore wrote:
No, not hard, just not portable. I hate to rely on Win32 calls unless there is absolutely no other way and the feature must be supported. I would rather not implement some features if it requires going to Win32. It is not that .NET works on many different platforms yet, but I do not want to go back and make all kinds of changes in the future if at all possible. I know one day the code will be going cross platform and want to be prepared.
Exactly. One way to do it, though, is wrap the functionality up in a wrapper class, and write one for each platform. But if there's a .NET implementation, that's much, much better.
Rocky Moore wrote:
This next winter I plan to invest some time into the Mono/Linux platform and see just how much can make it with with they have at the time.
I'd be interested to know how it goes.
Rocky Moore wrote:
You never know when Home Land Security will label Windows a virus
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
jdunlap wrote:
Rocky Moore wrote:
This next winter I plan to invest some time into the Mono/Linux platform and see just how much can make it with with they have at the time.
I'd be interested to know how it goes.
Yeah, it should be interesting. Have been keeping up with their progress but still have to find the time to dig in and see how much is really working along with how I like writing Linux programs
Rocky Moore <><
|
|
|
|
|
Hi everybody.
I posted a question here yesterday regarding the intricacies of the ECMA CLI standard, and how to determine the number of bytes you should read for a particular metadata table.
Zoiks, sounds exciting eh? You bet. If anyone has any interest in reading .NET dlls,or any knowledge of Partition 2 of the CLI standards, please check out my question as you may be able to help.
Much appreciated, thanks.
Jason King
jason.king@profox.co.uk
Feel the love at www.profox.co.uk
|
|
|
|
|
Heh, just realised I should have posted this on the .NET discussion page.
Please don't flame me, please don't flame me!
Jason King
jason.king@profox.co.uk
Feel the love at www.profox.co.uk
|
|
|
|