|
Could give you a cheater (or FillArc). If you want to do it dynamically you may have to do image processing logic. http://www.cs.rit.edu/~icss571/filling/how_to.html
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Hi,
I need help in avoiding the window which pops up during the USB detection. I am using Windows XP professional and I actually does not want any window to be popped up during this USB Mass storage device or MP3 Player Detection.
Please help me in this issue.
|
|
|
|
|
I have a stored proc in which I want to return a value. This is what I have in my c# code:
private void btnAdd_Click(object sender, System.EventArgs e)<br />
{<br />
strPartNumberInputReference = txtSearchPart.Text;<br />
strDwgNumber = txtDwgNumber.Text;<br />
strDwgRevision = txtDwgRevision.Text;<br />
strDwgLocation = txtDwgLocation.Text;<br />
<br />
ds2 = new DataSet();<br />
SqlParameter param1 = new SqlParameter("@PartNumber", strPartNumberInputReference); <br />
SqlParameter param2 = new SqlParameter("@DwgNumber", strDwgNumber);<br />
SqlParameter param3 = new SqlParameter("@DwgRevision", strDwgRevision);<br />
SqlParameter param4 = new SqlParameter("@DwgLocation", strDwgLocation);<br />
SqlParameter param5 = new SqlParameter("@PartTypeDescription", strPartTypeID);<br />
SqlParameter param6 = new SqlParameter(@ID, 0);<br />
param6.Direction = ParameterDirection.Output;<br />
ds2=SqlHelper.ExecuteDataset(this.connectionString, CommandType.StoredProcedure,"dbo.UpdatePart_Step_1_Test", param1, param5);<br />
dt2 = ds2.Tables[0];<br />
}
My question is on the bolded portions since this is what I just added. I haven't worked with ParameterDirection.Output before. I have (@ID, 0); I put the 0 in there because I saw a response to a similar question on CodeProject. Is this what it really should be? I am returning @ID which is an integer. If I write (@ID, int) the compiler doesn't like it.
Thanks!
|
|
|
|
|
SqlParameter param6 = new SqlParameter(@ID, SqlDbType.Int);
Look at the documentation for SqlParameter, particularly the overloaded constructors
|
|
|
|
|
Thank you, I will do that!
|
|
|
|
|
Although in the case of an ID I must certainly do use them. Don't forget to use SCOPE_IDENTITY in your sp instead of IDENTITY
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Can you elaborate? I'm having trouble with the stored proc. It says it's expecting @ID but not getting it.
CREATE PROCEDURE [dbo].[UpdatePart_Step_1]<br />
@PartNumber varchar (15),<br />
@PartTypeDescription varchar (60),<br />
@ID int OUTPUT<br />
<br />
AS<br />
declare @pt_id integer, @ThePartNumber integer<br />
<br />
if NOT EXISTS (Select * from Parts where PartNumber = @PartNumber)<br />
BEGIN<br />
<br />
SELECT @pt_id = pt.ID FROM PartTypes pt <br />
<br />
INNER JOIN Parts p on pt.ID = p.PartTypeID<br />
<br />
WHERE pt.Description = @PartTypeDescription<br />
<br />
insert into Parts<br />
(PartNumber, PartTypeID)<br />
<br />
VALUES<br />
(<br />
@PartNumber,<br />
@pt_id<br />
)<br />
<br />
<br />
END<br />
SELECT @ID=@@IDENTITY <big>Change this to SELECT @ID = @@SCOPE_IDENTITY?</big>return 0
|
|
|
|
|
Yeah, I use SET @ID = @@SCOPE_IDENTITY. In most cases the two methods are the same. However, if a trigger is called on your insert @@IDENTITY could be changed before your set (or SELECT both are valid)
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Hi,
When comparing two models in MS Rose I recieve the following problem:
** Exception **
Bai.Uml.Delta.PropertyComparison.GetValue(IElement element) called with element [3D3D4E3D017E] for property "Packages" failed.
Exception has been thrown by the target of an invocation.
-- Inner Exception --
Not enough storage is available to complete this operation.
Source: mscorlib
-- Stack Trace --
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodInfo.Invoke(Object obj, Object[] parameters)
at Bai.Uml.Delta.PropertyComparison.GetValue(IElement element)
** End Exception **
Anyone an idea what the reason can be and how to solve it?
Thanks,
Flash-Over
|
|
|
|
|
in my application contains two readbuttons when click one it should display data thatb is present in xml into combobox 1st time it works clearly but when user click on readbutton the value appears coupled with previous value inthe combobox
plz any one send a suggestion to solve this problem
gsvgnani
|
|
|
|
|
First step - post some code. There's obviously a bug there, we can't find it until we see it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Just a geuss, I forget to do that all the time on mistake.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Hello, thanks for helping me in advance...
I have a VB.net exe windows service using a C# dll that supports SSL listening on a specific port. The listener expects request from the browser which should auto-negotiate the SSL certificate (https://mywebsite.com:8443/...). When the IE browser setting "show friendly HTTP error messages" is turned on, the first request to my listener fails saying it can't find the server, then from that point on it works perfectly. When the setting is turned off, the first request is successfuly as is the rest of the calls. Does anyone have a idea of what could be happening and a resolution?
Any help would be greatly appreciated...
thanks nathan
|
|
|
|
|
Hi there,
Help! Is there any consensus as to the best way to handle dynamic button clicks? The buttons are being created dynamically and conditionally placed, depending on business logic.
Our problem is that on clicking such a button, the postback calls the Page_Load but not the Button_OnClick. I notice that if I use a static button on the page, this problem does not occur, but that thwarts our business logic.
What we're trying to achieve is to add an "Edit" button. When clicked, it changes the layout of the page (i.e. the aspx page), and no longer shows this "Edit" button. Instead, "Save", "Discard", etc...).
We're trying to avoid making the buttons static, with visibility controlled by logic, as that would be such a limiting factor. e.g. we may want a dynamic array of buttons where the size of the array is unknown at design time. How would their click events be caught?
Any ideas?!
Stewart
Button EditButton;
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) {
setupMostOfPage();
}
if (!editMode) {
setupEditButton();
}
}
EditButton_OnClick(object sender, EventArgs e) {
editMode = !editMode;
setupMostOfPage();
}
|
|
|
|
|
Are you hooking the Click event of the buttons in the setupEditButton method? Keep in mind that all controls are 'dynamic', even the ones created at design-time. Just inspect the code generated by VS when you create a button in the designer, and make sure you cover all your bases by comparing your code to the generated code.
:josh:
My WPF Blog[^]
|
|
|
|
|
If a static button can be 'remembered' between posts, can something be done to a dynamic one to persist it too?
John
|
|
|
|
|
The basic problem you have here is page life cycle. Between page init and page load, a control tree is built. After page load, this tree is populated with events from viewstate, which are then called. If your button does not exist prior to page load, it will not be in the tree, and so the event is lost.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Does this mean that dynamic buttons can never be used in webforms as the postback can't find the handler? If so, what's the point in their existence?
John
|
|
|
|
|
No, it means you have to be careful where you create them. I agree this can be a major problem, but it's doable, I've certainly done it. The LoadViewState method is the best place to create your buttons, as it's the last possible moment. Overload it, create your controls, then call the base method to load the view state.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Clever! This looks like the way, but I'm still having a few problems.
I find that the eventable control also has to be placed on the page, else its handler doesn't get called. Awkward if the handler changes the logic so that it shouldn't be placed! I got round that by using an invisible static PlaceHolder.
However, even with that, I can't always get the handler being called. Is there a best way of tracking the events in the debugger? I've not yet persuaded VS to do this.
|
|
|
|
|
The control needs both to be present and to be in the same place in the control tree for it to get it's event. You can set it's visible property later, if you want to hide it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
Using VS2003 and C#, I have created oleDbAdapaters to fill a data set and used a combo box to allow easy selection of choices for amending record fields. Here's the code for the combobox:
// comboBoxMembershipLevel
//
this.comboBoxMembershipLevel.DataBindings.Add(new System.Windows.Forms.Binding("SelectedItem", this.myClubDataSet12,"MembershipLevels.MembershipLevelName"));
this.comboBoxMembershipLevel.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.myClubDataSet12, "MemberDetails.MembershipLevel"));
this.comboBoxMembershipLevel.DataSource = this.myClubDataSet12.MembershipLevels;
this.comboBoxMembershipLevel.DisplayMember = "MembershipLevelName";
this.comboBoxMembershipLevel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.comboBoxMembershipLevel.Location = new System.Drawing.Point(584, 80);
this.comboBoxMembershipLevel.Name = "comboBoxMembershipLevel";
this.comboBoxMembershipLevel.Size = new System.Drawing.Size(121, 21);
this.comboBoxMembershipLevel.TabIndex = 40;
this.comboBoxMembershipLevel.ValueMember = "MembershipLevel";
//
The table "MembershipLevels" has three fields - ID(autogenerated key), MembershipLevel(int) and MembershipLevelName(text). The MemebershipLevel is stored for each record in the table MembersDetails.MembershipLevel(int).
When I select the first member of the drop down list and then move away and back to the record concerned I get 'System.Data.DataRowView' in the display box. Chosing any of the other members of the drop down list and all works fine - it only occurs when I chose the first member of the drop down list.
Saving the changes from the dataset to the database whilst the 'System.Data.DataRowView' is showing updates the database with the correct field data (ie a number and not 'System.Data.DataRowView').
I can't find any help after much searching the net.
Anyone know why?
TIA.
Regards,
Glen Harvy
|
|
|
|
|
Why are you adding items to the combo's Databindings collection and setting the DataSource. That's not a normal thing to do, it might be "confusing" the combo's databinding logic. Does the problem keep happening if you remove these two lines?
this.comboBoxMembershipLevel.DataBindings.Add(new System.Windows.Forms.Binding("SelectedItem", this.myClubDataSet12,"MembershipLevels.MembershipLevelName"));
this.comboBoxMembershipLevel.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.myClubDataSet12, "MemberDetails.MembershipLevel"));
:josh:
My WPF Blog[^]
|
|
|
|
|
Thanks for your assistance:
Josh Smith wrote: Why are you adding items to the combo's Databindings collection and setting the DataSource. That's not a normal thing to do,
The form is a collection of all the data related to one record with the ability to move forward and backward between records. I want to be able to change the dataset values of these individual records/fields via a combobox selection of options as they are displayed. Adding the items to those form fields allows this to happen except with the problem as descibed. The change in values is also detected correctly and saved to the database.
Josh Smith wrote: Does the problem keep happening if you remove these two lines?
This resolves the problem as described BUT if I change the data in the field then the new data displayed in the field remains constant no matter which record I move to. In other words, the dataset is not updated. Additionally, the change in the fields value is not detected and the database is not updated when requested.
HAVING SAID ALL THE ABOVE
I changed the source as you suggested and do you think I can now return the code back to what it was and get it to work as described above
It strikes me that I'm trying to do something in a way that can't be done.
Any suggestions
Glen Harvy
|
|
|
|
|
I am using listview to display an entity called step. I am displaying the Name of the steps in the list and keep the STEP object in each item's TAG.
The listview properties I am setting are,
alignment = Top
View = SmallIcon
After getting the data in the listview, I am using following two lines
lstSteps.Sorting = SortOrder.Ascending;
lstSteps.Sort();
Because of sorting : some items appear in the line of other items rather than all items one below other.
I am sure this is happening only after i apply sorting. Without sorting it is working fine.
Due to some restrictions I cannot apply sort before getting that entity (steps) in ListView
Plz help me
abhijeet
-- modified at 9:20 Wednesday 12th July, 2006
|
|
|
|
|