|
I have a problem about lock in C#.
I have written a multithread program, but the other day, the program hung up suddenly.
I have checked the code throughly but i could find nothing wrong.
In order to realize sync., i use lock(this) at several places.
But to my dismay, i was told this is not a good way at all recently.
Can anyone give me some information about this?
Thank you
-- modified at 6:57 Friday 24th March, 2006
|
|
|
|
|
Who told you that it wasn't a good way, and what was the arguments for that?
Locking should of course be kept as a minimum, and to avoid deadlocks a thread should never lock more than one object at a time. Still, for sharing data between threads there is hardly any alternative.
---
b { font-weight: normal; }
|
|
|
|
|
Why this methid AcceptTcpClient() takes much time to connectd and i can't connect.
Any idea????
_____________________
Proud to be Albanian
_____________________
|
|
|
|
|
Looks like your client is not trying to connect properly.
Ed
|
|
|
|
|
I never had that experience. Maybe something wrong with your code!
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
Hi,
I need to read a csv file...I m using OleDB Connection for this i have done this code...
OleDbConnection conCSV = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + dirName + ";Extended Properties='Text;HDR=Yes;FMT=Delimited;IMEX=1'" );<br />
<br />
OleDbDataAdapter daDBF = new OleDbDataAdapter<br />
( "SELECT * FROM " + fileName, conCSV );<br />
<br />
daDBF.Fill( DS, "Bids" );<br />
<br />
DS.WriteXML( TestFilePath );
But I m not Getting Full Data out, From CSV file some of the Data gets Truncated On Server It's Working fine On My local Machine...
Can Anybody sort out this...Pls
Thanx & Reagards
Anuj Kamthan
Software Developer
Solversa Technologies,
Pune - 411007, India.
http://www.solversa.com
-- modified at 6:11 Friday 24th March, 2006
|
|
|
|
|
See if you can do something like daDBF.CommandTimeOut(3000); or something.
You should set the OleDBCommand.CommandTimeout setting higher than the default 30 seconds first t see if it rectify's the situation..
Practice sesquipedalianism!
|
|
|
|
|
Thanks a lot for your interest
But Problem is different it's not because of timeout...
When i m reading the csv file and filling it in to dataset...whole records ll copied in to dataset but, there is an column in my csv file "Description" only this column's data ll truncate if it's very big...
Is there any limit in dataset...Can't save more then 255 character in a column.
Thanx
Anuj Kamthan
Software Developer
Solversa Technologies,
Pune - 411007, India.
http://www.solversa.com
|
|
|
|
|
I need C# Code to Show/Hide Quick Launch Bar.
|
|
|
|
|
Dont repost, you asked this yesterday... you will need to look in the WinAPI somewhere. I dont know where.
|
|
|
|
|
Hi..
How do i load the textfile i open into a richTextBox?
The best thing for me would be if i save this directory path that i choose in a "config file" so it saves there. Second i want to browse the text file (.scp) in my richTextBox.
<br />
private void btnOpen_Click_1(object sender, EventArgs e)<br />
{<br />
OpenFileDialog fdlg = new OpenFileDialog();<br />
fdlg.Title = "Emu Open File Dialog";<br />
fdlg.InitialDirectory = @"c:\";<br />
fdlg.Filter = "Emu Files (*.scp*)|*.scp*|Emu Files (*.scp*)|*.scp*";<br />
fdlg.FilterIndex = 2;<br />
fdlg.RestoreDirectory = true;<br />
if (fdlg.ShowDialog() == DialogResult.OK)<br />
{<br />
textBox20.Text = fdlg.FileName;<br />
}<br />
Anyone that can help me?
Regards
//Aeq...
|
|
|
|
|
You want to display the text of the .scp file into
the richtextbox , right?
This should work for u.
OpenFileDialog opdf = new OpenFileDialog();
opdf.ShowDialog();
richTextBox1.LoadFile(opdf.FileName,RichTextBoxStreamType.PlainText);
Hope that works fine for u
Regards,
Pramod
|
|
|
|
|
Hey guys, i'm wondering how I can bind DataGrideView to dataset, like data gride. so for instance when i click on a record in my DataGriedView I can have it in some Text Boxes for exiting.
Thanx
Mr.K
|
|
|
|
|
Like the GridView, the DetailsView control can bind to any data source control and exploit its set of data operations. It can page, update, insert, and delete data items in the underlying data source as long as the data source supports these operations. In most cases, no code is required to set up any of these operations. You can customize the user interface of the DetailsView control by choosing the most appropriate combination of data fields and styles in much the same way that you do with the GridView. Finally, the DetailsView control fully supports adaptive rendering and renders successfully on mobile devices.
The DetailsView control deliberately doesn’t support templates. A fully template based details-view control is the FormView. FormView is a new data-bound control that works like the templated version of the DetailsView. It renders one record at a time picked from the associated data source and optionally provides paging buttons to navigate between records. Unlike the DetailsView control, FormView doesn’t use data control fields and requires the user to define the rendering of each item using templates. The FormView can support any basic operation its data source provides.
In ASP.NET 2.0, data sources, GridView, and DetailsView controls enable a no-code master/detail scenario. A master/detail page contains a master control (such as a GridView) and a detail control (such as a DetailsView), each bound to its own data source. The trick is in binding the detail control to a data source represented by the currently selected record.
Practice sesquipedalianism!
-- modified at 8:17 Friday 24th March, 2006
|
|
|
|
|
Hi,
I've already asked this before in this forum, but I still have the same problem.
I hope somebody can help me. (I've tried google and msdn)
I've wrote a wrapper for a COM module. Some parameters for the COM functions need to be passed by-value:
(long*, BSTR*, ...)
I've tried round about everything, but I always get a type mismatch error (0x80020005, DISP_E_TYPEMISMATCH)
(ref string, normal strings, with the [MarshalAsAttribute(UnmanagedType.BStr)] attribute, with unsafe keyword etc...) I also tried to change longs of the COM module to ints
here's a sample of one of the wrapped methods:
<br />
unsafe public int GetDlgText(int dlgid, int fldid, int row, int col, [MarshalAsAttribute(UnmanagedType.BStr)] string text){<br />
int returnvalue = -1;<br />
try{<br />
object[] cmds = { dlgid, fldid, row, col, text };<br />
returnvalue = Convert.ToInt32(Interaction.CallByName(idisp, "GetDlgText", CallType.Method, cmds));<br />
}
catch(Exception e) {<br />
lasterrormessage = "Could not invoke GetDlgText function: " + e;<br />
}
return returnvalue;<br />
}
the documentation says it's like this: long GetDlgText(long DlgId, long FldId, long Row, long Col, BSTR* Text);
What on earth could be the problem?
Tnx!!
Coulda, woulda, shoulda doesn't matter if you don't.
|
|
|
|
|
Hi!
I've sort of followed the replies you got before and they seemed to be very reasonable...
1.) You absolutely MUST marshal the C++ long parameters als int in .NET. If you don't do this then the offset for everything else on the stack is off, no matter what you use to marshal the BSTR*.
2.) Don't know why you're using the unsafe keyword in the declaration above - try removing it
3.) You could try removing the MarshalAs attribute altogether and put in a StringBuilder as the las parameter.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hey,
Tnx for your reply.
Sure they were reasonable, I've tried about everything I could find on the I-net and here on CP (including what you just replied).
Still the same error.
tnx for the effort though.
Coulda, woulda, shoulda doesn't matter if you don't.
|
|
|
|
|
Thank u for the response for the last post....Now My problem is...
I want to keep track of all the users who are accessing my application, this is in intranet environiment.All the users who are accessing the application must able to see the names of all users who are using the application.How to achieve this....
|
|
|
|
|
Do you have a login system?
--------------------------------------------------------
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
it's a windows network,my intention was i am able to know who is hitting my application but not able to keep track until they close the application(it's a web application)
ALL THE BEST
|
|
|
|
|
I need to invoke a javascript function in an .aspx file using webBrowser1.Document.InvokeScript("JavaScriptFunctionName")... The problem with me is I dont have Main, I dont have any Form, what I've is just a classLibrary in C# where am invoking the JavaScript...
function fnTestJScript()
{
return ("My Test Succeeded");
}
webBrowser1.Navigate(theURL);... This is what i used to navigate the url and webBrowser1.Document.InvokeScript("JavaScriptFunctionName"), this should return "My Test Succeeded"... But is giving some exception or is null, if i use object...
BapiLolly
|
|
|
|
|
Hi experts!
I'm working on a project where i need to write some low-level hardware stuff in C++ and then allow access to it from the higher level C# stuff.
To test my different approaches to build a bridge from C++ to C# i also wanted to try writing a COM object, using the wizard it was almost too easy. But, alas, it didn't work.
I get an InvalidCastException in the last line of the client code:
Unable to cast COM object of type 'ATLServerTest2.DeviceClass' to interface type 'ATLServerTest2.IDevice'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{633DB896-4FA1-4E6B-85CF-C1B23BD5FE1C}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
I hope someone out there has tried doing the same, or at least has some suggestions as to possible faults.
Thanks in advance.
Rasmus
Client (in C# 2.0)
using ATLServerTest2;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Device device = new Device();
IDevice idevice = device as IDevice;
String s;
idevice.getName(out s);
}
}
}
Server (in C++):
[
object,
uuid("633DB896-4FA1-4E6B-85CF-C1B23BD5FE1C"),
helpstring("IDevice Interface")
//pointer_default(unique)
]
__interface IDevice : IUnknown
{
[helpstring("method getName")] HRESULT getName( [out] BSTR *name );
};
[
dispinterface,
uuid("67C3F875-3BF5-495C-91AA-469E9EA33C46"),
helpstring("_IDeviceEvents Interface")
]
__interface _IDeviceEvents
{
};
[
coclass,
//default(IDevice, _IDeviceEvents),
default("IDevice"),
threading(apartment),
//support_error_info("IDevice"),
//event_source(com),
aggregatable(never),
vi_progid("ATLServerTest2.Device"),
progid("ATLServerTest2.Device.1"),
version(1.0),
uuid("AF76CC05-0F41-45EB-AE67-485FDD8AF343"),
helpstring("Device Class")
]
class ATL_NO_VTABLE Device :
public IDevice
{
public:
Device()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHODIMP getName ( BSTR *name ) {
CComBSTR _name ( "test name" );
*name = _name.Detach();
return S_OK;
}
};
|
|
|
|
|
Hi all
How to insert an EMF file in to the MS EXCEL Sheet by drag and drop.
What's the appropreate dataformat for SetData method.
Iam able drop Bitmap images in to the sheet but could not do it using DataFormats.MetafilePict.
Gokul
|
|
|
|
|
I just want to show/hide QuickLaunch Bar or Any Other Toolbar(Desktop, Language Bar etc.). I have almost seen all the features of shell32.
first I add shell32.dll (search from the Windows folder) to the reference.
Then write the following code
Shell32.ShellClass objShel = new Shell32.ShellClass();
You can see all properties of TaskBar --> Right cick --> Context Menu.
But i found Toolbars no where so that I can access The Toolbars . If any one have already worked on it then please guide me to show/hide taskbar toolbar.
|
|
|
|
|
Hi,
I want to write an application that i can use IE(Internet Explorer) Dll to navogate Interenet and use IE Facilities . how i can do this job?
---------------------
Areff.HB@Gmail.com
---------------------
|
|
|
|