|
Thanks Vikram, d@nish,
Thanks for the tip Vikram.
d@anish - Yes you're right, however I get the error when applied to my namesBindingSource
Thanks
Jon
|
|
|
|
|
Hi all,
I need change text in external .rtf file using c# code..
thank you..
%#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG
|
|
|
|
|
Seems like you've been asking this for days. I suspect that putting it into a rich text box is the easiest way to change it and keep it in RTF format. Otherwise you need to get another RTF parser, or write one.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Good afternoon.
I have been tasked with "scraping" the URL from a firefox browser from our C# program. The issue I ran into is that the Address bar in Firefox is not accessible.
Can any body help me in this
Thank you for your time on this matter,
Mihir
|
|
|
|
|
hi all,
on my aspx page which is a child page of a master page.
i have a textbox say "TextBox1" with that i have one button say "Button1"
now on ClientClick on Button1 i want to open a popup which will have some list box say "LSt1" and a button say "OK"
as user selects some option from lst1 and clicks on Ok then those selected values should come in Textbox1 without any page refresh.
I am able to do this all but only the problem is my base page is postbacking itself.
A glimpse of code i m trying to use:
main aspx page>>>>
function OpenNewPopUpWindow(Url)
{
var Attributes='width=400,height=300,left=200,top=200,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=yes, resizable=no';
window.open(Url,"PoPup",Attributes);
}
asp:Button ID="btntxtFindingsComments" runat="server" CausesValidation="False" Text="..."/>
main aspx.cs page>>
btntxtFindingsComments.Attributes.Add("onClick", "javascript:OpenNewPopUpWindow('PoPup.aspx?Id=" + txtFindings.ClientID + "&CommentId=901');");
Popup.aspx>>
function LoadValues(clientCtrl, selectedValue)
{
window.opener.document.getElementById(clientCtrl).value = selectedValue;
self.close();
}
<asp:listbox id="lstTIPComments" runat="server" appenddatabounditems="false">
<asp:button id="Button1" runat="server" text="Close" onclick="Button1_Click">
popup.aspx.cs>>
protected void Button1_Click(object sender, EventArgs e)
{
string selectedValue = "";
for (int i = 0; i < lstTIPComments.Items.Count; i++)
{
if (lstTIPComments.Items[i].Selected == true)
{
selectedValue = " " + selectedValue + lstTIPComments.Items[i].Text + " ";
}
}
Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "LoadValues('" + Request.QueryString["Id"].ToString() + "','" + selectedValue + "');");
}
|
|
|
|
|
sanchit_mum07 wrote: on my aspx page
Guess you meant to post this in the ASP.NET forum ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I was a VB.Net guy, and now I became a C# programmer, and I have a little question. In VB.Net there is a possibility to select a control in the drop down list at the top of the screen, and then view all the possible events for this control at the other drop down list (on the other side of the screen). Is it possible in C# as well ? I can't figure out how to do it.
|
|
|
|
|
Events on C# located on the properties window for each control yellow icon on the top
|
|
|
|
|
ya, from thats ok, but how from source like in vb , from vb you can select controls and their related all events from aspx.vb page.
So same way, how can we do in c#.net
|
|
|
|
|
In C# you don't have the option to select the control and than select it's events... from the source file.
You have to refer to property page.
|
|
|
|
|
Look at the code that's generated in the designer file. You can hook up the events as delegates in code, if you like. However, you can't specify that a method handles an event in the place where you define the method, the way VB does it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i have the following code:
SqlCommand insertcommand = new SqlCommand();
insertcommand.Connection = con; //connection to SQLserver2000
insertcommand.CommandType = CommandType.StoredProcedure;
insertcommand.CommandText = "InsertQueryoperation";
SqlParameter AwardNum = new SqlParameter("@Award_num",SqlDbType.Int);
//@Award_num SQL Variable on InsertQueryoperation procedure
AwardNum.Direction = ParameterDirection.Output;
// parameter should sent the data to DataSource
txtAward.Text=AwardNum.Value.ToString();
insertcommand.Parameters.Add(AwardNum);
insertcommand.Connection.Open();
insertcommand.ExecuteNonQuery(); //NullReferenceException Accoured here
insertcommand.Connection.Close();
what is the problem with that code?
regards
|
|
|
|
|
The only problem that seems to be the one for me is that the parameter direction should be input not output
you can get more detail by looking at the exception stack trace.
|
|
|
|
|
Hi.. I am making a site using .net 2.0 with C#. On my site client may upload image or pdf document. So how to convert the pdf document to image format and display it as image? Its urgent...
|
|
|
|
|
needhi_p wrote: Its urgent
But not urgent enough to google? The first and third hits look promising here[^]
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
The code below is all in one class:
<br />
private string test = "nothing";<br />
<br />
public void deviceArrival(DeviceMonitorEvent dme)<br />
{<br />
this.test = "changed";<br />
}<br />
The event handler (method) is only run in the background thread, the instance variable is only used in my main thread.
When the event is fired, I want to change the value of 'test' in the main thread to "changed".
Currently it stays as "nothing" because I don't know how to cross-thread the two.
Any ideas?
Cheers,
modified on Wednesday, May 21, 2008 1:00 AM
|
|
|
|
|
Without seeing any of your code, just how are we supposed to help you?
You have to use a delegate to call a method that does the UI work, and when the event is triggered, you call this.Invoke() or one of its overloads. As to what the compiler is complaining about, I have no idea.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Vikram A Punathambekar wrote: Without seeing any of your code, just how are we supposed to help you?
The code below is all in one class:
<br />
<br />
private string test = "nothing";<br />
<br />
public void deviceArrival(DeviceMonitorEvent dme)<br />
{<br />
this.test = "changed";<br />
}<br />
<br />
The event handler (method) is only run in the background thread, the instance variable is only used in my main thread.
When the event is fired, I want to change the value of 'test' in the main thread to "changed".
Currently it stays as "nothing" because I don't know how to cross-thread the two.
Cheers,
|
|
|
|
|
I thought you were updating a UI control? If you're just updating a class member, you don't need delegates. Perhaps the event is not being fired? I can't think of any other reason your snippet does not work. Did you place a breakpoint and see if it stops there?
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Vikram A Punathambekar wrote: I thought you were updating a UI control?
Yea i am, but if i can get the above code working that will solve my program.
Ive edited the question to be clearer though.
Cheers,
|
|
|
|
|
May be you will have to declare your variable as volatile for allowing it to be updatable by multiple threads.
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
Yea I tryed that but it still dosen't seem to work:
<br />
<br />
private volatile string test = "nothing"<br />
<br />
public void deviceArrival(DeviceMonitorEvent dme)<br />
{<br />
this.test = "fgfg";<br />
}<br />
<br />
The result still comes out with "nothing" when I access it in my main thread.
The event is definately firing, ive tested it with a messagebox.
Cheers,
|
|
|
|
|
1) Create a function in the form class to update your presentation.
2) Now create and initialize the MethordInvoker with the above function
with in the thread.
MethodInvoker mi = new MethodInvoker(UpdateUI);
3) Now you can get your function in the Presentation to uodate the UI by calling mi.Invoke();
Hope this helps.
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
There really isn't a simple answer.
The problem is that the background thread may well be updating it, but that doesn't necessarily mean that the main thread is actually going to read it. You have to synchronize the execution of the two threads for the update to be seen by the other thread.
If the 'main' thread is running UI, as the others have said, one approach is to send a message to the main thread using Control.Invoke . It's often better to send the data that's changed in a parameter of the method that's invoked.
Otherwise the tidiest approach generally is to use locks, for example, the Monitor class, whenever the value is read from or written to (you must do both, and you must lock the same object in all situations). However, you now have to be aware of the possibility of deadlock - any time more than one lock is acquired at the same time, you can get into a situation where one thread owns lock A and needs lock B, while another owns lock B and needs lock A (bigger situations where multiple threads all own some locks and need others can also exist, this is just the smallest simplest example). Each thread ends up waiting for the other, neither can proceed, and generally the program becomes unresponsive. The only true way to avoid a deadlock is to ensure that locks are always acquired in the same order, where multiple locks are acquired by the same thread. This generally leads to fewer, coarse-grained locks. However, this can cause these locks to become 'hot-spots', where threads end up waiting for one another to release commonly-used locks. In the worst case you can get a 'lock convoy' where the threads never actually run in parallel, instead they run in turn as each acquires a lock and all the others wait on that lock.
Lock-free programming is even harder.
I would generally be happy not to write multithreaded programs or if I do, to rely solely on messaging. The more highly concurrent you get, the more complicated the system becomes and the higher chance of a race condition (as you've seen) or a deadlock.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Hi Mike,
Thanks for your help, ive resolved the problem now.
Cheers,
|
|
|
|