|
I guess that as long as it works i doesn't matter but
why would putting your structs inside a class throw the above exception?
Kev Pearman MCAD
|
|
|
|
|
Well, I've seen some strange things happen when I've added private classes to some of my form-derived classes.
Basically, the visual designer stores some resources in .resx files (for example image data).
These XML-based files hold serialized data that can be retrieved by an object name (just add a picture box to a form and than look at what's generated in InitializeComponent() ).
If, by which means ever, such a resource cannot be found than the visual designer will choke and running the application will create an exception similar to what adnan wrote.
I think that he had introduced some naming conflicts, so removing the offending struct declarations from the .cs file fixed the way .NET accesses its embedded resource streams.
mav
|
|
|
|
|
hi,
I want to change the color of the scrollbars(horizontal and vertical) that appear with panel control (when I set autoscroll true) .if anyone knows how to set different styles to scrollbars of a (container) control in C#, pl let me know..
Thanks
|
|
|
|
|
Can any one help me out. I am trying to call an external .exe file whihc creates mpeg files in my project. Is there a efficient way to do so.
Thank you
pavan
|
|
|
|
|
externalProcess = System.Diagnostics.Process.Start(exeName, parameters);
externalProcess.WaitForExit(1000);
|
|
|
|
|
Hey, Can anyone tell me how to use the Session and Application variables to distinguish between 2 users. I tried SessionID. Couldn't make it happen. Please help
|
|
|
|
|
This question belongs in the ASP.NET forum.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hey, Can anyone tell me how to use the Session and Application variables to distinguish between 2 users. I tried SessionID. Couldn't make it happen. Please
|
|
|
|
|
You must set the enable session property to true
ex: [WebMethod(EnableSession=true)]
Choose the appropriate sessionState in the web config file.
(The default is good enough for normal purpose)
Initialize ur session variable
ex: Session["test"] = ""; in the Session_Start of Global.asax
u can assign values to test variable in ur web service methods.
cool man
|
|
|
|
|
I have a problem trying to zoom in on a bitmap i opened in a form.I couldnt find any simple code example that illustrates how to implement zooming from inside a program.I would appreciate if anyone can help me out.Please contact me at gehanmustafa@hotmail.com.
Yours,
Gehan Mustafa
|
|
|
|
|
gijoebijoe wrote:
Please contact me at gehanmustafa@hotmail.com.
No.
All you need to do is use DrawImage to draw the image at a larger than normal size.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hi,
I'm having problems with issuing a SQL ExecuteNonQuery in my webService. It always returns an int with value -1.
I'm executing a stored procedure which should return a rowcount of the number of matching rows, which is 0 or 1. There is a matching row, so i should get 1 returned.
The code i am using is as follows:
--------------------------------------------------------------------------
string CnStr = "data source=localhost; Integrated Security=SSPI;Initial Catalog=Active";
SqlConnection sqlCn = new SqlConnection();
//Pass connection string to the SQLconnection object
sqlCn.ConnectionString = CnStr;
// Create a sqlcommand object to execute sql stored procedure
//pass query string and connection object to Command object
SqlCommand cmd = sqlCn.CreateCommand();
//Specify the Stored procedure to be executed
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "stp_Check";
//Create a Paramater object to provide input and return
cmd.Parameters.Add("@Mac", SqlDbType.Char,17);
cmd.Parameters["@Mac"].Value = strMAC;
//Open the connection
sqlCn.Open();
//Execute the query - return rowcount
int intMACAddressRows;
intMACAddressRows = cmd.ExecuteNonQuery();
-----------------------------------------------------------------------
If i execute the Stored procedure directly it works fine (i.e. one row is returned).
Thanks for any help you can give.
Cheers,
Colin
|
|
|
|
|
Update, Insert, and Delete commands will return the number of rows affected. Anything else returns -1.
creganc wrote:
If i execute the Stored procedure directly it works fine (i.e. one row is returned).
I'm unsure whether you mean the row is returned or the count of rows affected is returned when the procedure is executed directly. If you mean the actual row is returned, it is a Select statement and the return value will always be -1.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hi Charlie,
Thanks for the prompt response.
Sorry, should have said that the stored procedure is just issuing a select statement.
Ah, i thought the executenonquery would return the rowcount from the select.
As i only want to know if the row exists so should i use executescaler instead? Does that return the count as an int?
Thanks again for your help.
cheers,
Colin
|
|
|
|
|
ExecuteScalar returns an object which is the first column of the first row of the records returned. So, if the select statement is something like:
SELECT Count(*) FROM MyTable WHERE MyColumn = @MyParam you'd get the number of rows like this:
int rowCount = (int)command.ExecuteScalar();
Charlie
if(!curlies){ return; }
|
|
|
|
|
Thanks Charlie thats great.
Thanks for your help.
Cheers,
Colin
|
|
|
|
|
Hi,
I want to develop/use expense management tool similar to Microsoft's PocketPC Expense. I would like to create categories on the fly and data to be stored in xml for easy porting? Does any one has source code or ideas to do this?
Can any one point me to a open source for this?
|
|
|
|
|
I have a program that checks for the existence of a file and then reads the content, but I am running into a problem when I try to read, the file is still being written to. I have to ideas on how to solve, but unsure of the methods/syntax. I realize the solution is probably simple, but I'm failing to see it.....
1st - I can't find a property for the file or fileinfo class for 'locked', does such a method exist elsewhere? I am having trouble finding it.
2nd - I can catch the error, but can I in effect do a try {} catch {} re-try?
|
|
|
|
|
Use one of the larger overloads for the FileStream to request the access you want, as well as what access you want to share. If this is in conflict (you want write access but another process isn't sharing write access), an UnauthorizedAccessException will be thrown (this is documented for the FileStream class in the .NET Framework SDK).
If you want to continually try, you can use a simple loop but be careful. You might consider using a for loop with a set maximum number of tries before giving up, otherwise that thread of execution will block indefinitely:
FileStream file = null;
using (file)
{
while (true)
{
try
{
file = new FileStream("file.lock", FileMode.OpenOrCreate,
FileAccess.Write, FileShare.Read);
}
catch (UnauthorizedAccessException)
{
}
catch (Exception e)
{
break;
}
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
may be u can try this in a loop
FileInfo fi = new FileInfo(parm1);
bool fileIsLocked;
if ( fi.Exists )
{
fileIsLocked=false;
FileStream fileStream=null;
try
{
fileStream = fi.OpenRead();
fileStream = null;
}
catch(Exception)
{
fileIsLocked=true;
}
}
cool man
|
|
|
|
|
Please help me with this problem: I have a custom ToolBar control, which instantiates a PageSizeCbo, a custom server control which inherits from DropDownList. The ToolBar and the PageSizeCbo render on the page fine, but no events seem to fire.
Here is the ToolBar class:
<br />
<br />
using System;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
<br />
namespace QuoteBuilder_0_3.Controls.ToolBar {<br />
<br />
public class ToolBar : Control, INamingContainer {<br />
private System.Collections.ArrayList toolList = new System.Collections.ArrayList(10);<br />
public enum ToolType { PageSizeCbo=0 }<br />
<br />
public ToolBar() {}<br />
<br />
private void build () {<br />
Controls.Add(new LiteralControl("<div class='ToolbarContainer'>"));<br />
Table table = new Table();<br />
table.CssClass = "Toolbar";<br />
TableRow row = new TableRow();<br />
TableCell sepCell = new TableCell();<br />
sepCell.CssClass = "ToolbarSeparatorCell";<br />
sepCell.Controls.Add(new LiteralControl("|"));<br />
for (int i=0; i<toolList.Count; i++) {<br />
if (null == toolList[i])<br />
break;<br />
TableCell btnCell = new TableCell();<br />
btnCell.CssClass = "ToolbarButtonCell";<br />
btnCell.Controls.Add((Control)toolList[i]);<br />
row.Cells.Add(btnCell);<br />
row.Cells.Add(sepCell);<br />
}<br />
table.Rows.Add(row);<br />
Controls.Add(table);<br />
Controls.Add(new LiteralControl("</div>"));<br />
}<br />
<br />
public void AddTool (ToolType toolType) {<br />
switch (toolType) {<br />
case ToolType.PageSizeCbo:<br />
toolList.Insert((int)toolType, new PageSizeCbo());<br />
break;<br />
}<br />
}<br />
<br />
protected override void Render(System.Web.UI.HtmlTextWriter writer) {<br />
build();<br />
base.Render (writer);<br />
}<br />
<br />
protected override bool OnBubbleEvent(object source, EventArgs args) {<br />
Context.Response.Write("bubble handled!");<br />
return true;<br />
}<br />
}<br />
}<br />
And here is the PageSizeCbo:
<br />
using System;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
<br />
namespace QuoteBuilder_0_3.Controls.ToolBar {<br />
public class PageSizeCbo : DropDownList, IToolBarTool {<br />
private const int TOTAL_OPTIONS = 5;<br />
private int [] pageSizeValues = new int[TOTAL_OPTIONS] { 0, 10, 25, 50, 100 };<br />
private string [] pageSizeDisplay = new string[TOTAL_OPTIONS] { "Unlimited", "10", "25", "50", "100" };<br />
<br />
public PageSizeCbo() : base() {<br />
SelectedIndexChanged += new EventHandler(PageSizeCbo_SelectedIndexChanged);<br />
Build();<br />
}<br />
<br />
public Control Build () {<br />
for (int i=0; i<TOTAL_OPTIONS; i++) {<br />
Items.Add(new ListItem(pageSizeDisplay[i], pageSizeValues[i].ToString()));<br />
}<br />
CssClass = "pageSizeCombo";<br />
EnableViewState = true;<br />
AutoPostBack = true;<br />
return this;<br />
}<br />
<br />
private void PageSizeCbo_SelectedIndexChanged(object sender, EventArgs e) {<br />
Context.Response.Write("Raising Bubble Event...<br/>");<br />
RaiseBubbleEvent(sender, e);<br />
}<br />
<br />
protected override bool OnBubbleEvent(object source, EventArgs args) {<br />
Context.Response.Write("Handling bubble from base cbo...");<br />
return false;<br />
}<br />
}<br />
}<br />
I am new to custom server controls, so any help would be very appreciated!
Thanks,
Brent
|
|
|
|
|
You should post this in the ASP.NET[^] forum.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hello,
i have a WebService on a Desktop-server and a MobileWebApplication for a PocketPc. Now i want to extend this MobileWebApplication in that way, that when the user is on certain place the Application is noticed the user with some information. Do i here need a GPS System or can i reached this things with WLAN? and/or is this difficult to implement?
thanks in advance
regards
|
|
|
|
|
Yes, you need GPS. GPS data is not difficult to parse, but communication may depending on your device. Be sure to get a GPS that is NMEA 2.0 compatible, which most these days are. It's a simple text format that you can find lots of information about on the web by performing a search.
MSDN Online Library[^] has some articles, and you could always google[^] as well.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I want my C# program can cut some region of a picture,
What should I do in MouseDown, MouseMove, MouseUp Event,
to select the scale of the picture I want to cut,
Is there any sample...??
Thanks !!
|
|
|
|