|
Thanks..... working on it rite now....
|
|
|
|
|
I'm trying to resolve this error (pointed at first case 1: under Id)
Control cannot fall through from one case label 'case 1:' to another.
Control cannot fall through from one case label 'case 3:' to another.
Sample Code:
public string UniqueStrings(string ck1, string ck2, int Id)
{
switch (Id)
{
case 0:
{
switch(Convert.ToInt64(ck1, 16))
{
case 0x00: return "zero-zero";
case 0x01: return "zero-one";
case 0x02: return "zero-two";
case 0x03: return "zero-three";
case 0x04: return "zero-four";
case 0x01: return "zero-five";
case 0x06: return "zero-six";
case 0x07: return "zero-seven";
default: return "UNDEF";
}
}
case 1:
{
switch(Convert.ToInt64(ck1, 16))
{
case 0: return "one-zero";
case 1:
{
if (Convert.ToInt64(ck2, 16) == 1) return "one-one-one";
else if (Convert.ToInt64(ck2, 16) == 5) return "one-one-five";
}
case 3:
{
if (Convert.ToInt64(ck2, 16) == 2) return "one-one-two";
else if (Convert.ToInt64(ck2, 16) == 3) return "one-one-three";
}
case 4: return "one-four";
default: return "UNDEF";
}
}
case 2:
switch(Convert.ToInt64(ck1, 16))
{
case 0x4E: return "two-fourE";
case 0x52: return "two-five2";
default: return "UNDEF";
}
}
}
}
Can anyone help? I'm stuck with this problem.
|
|
|
|
|
Blubbo wrote:
I'm trying to resolve this error
Control cannot fall through from one case label 'case 1:' to another.
Control cannot fall through from one case label 'case 3:' to another.
Make sure you put a break; in at the end of the code for case 1: and again at the end of the code for case 3:
C# does not support dropping from one case to another unless the previous case statement was empty.
i.e.
switch(id)
{
case 1:
case 2:
break;
} is valid
switch(id)
{
case 1:
case 2:
break;
} is not valid
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
For the effect of falling through, you can use goto like so:
switch(i)
{
case 0:
goto case 1;
case 1:
goto case 2;
case 2:
return;
case 3:
case 4:
break;
default: throw new Exception("Ack!");
} It's not falling through to other cases, but I thought it was worth mentioning.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Same user as Blubbo...
Yeah I got it to work. I have checked out other documentations even the c# specification documentation.
I added break statement on every case and now things work. thanks to all for help.
|
|
|
|
|
Hi.
I have a simple standard button- FlatStyle is Flat, I've custom set the forecolor and backcolor to ActiveCaption, I have a small bmp image for the button, and have docked it to the right of a custom caption bar control. My complaint is that when I do a mousedown on the button, an ugly blue sort of highlighting appears both behind the button with a few lines across the image itself. How do I turn this off?
-David
|
|
|
|
|
not sure about the button, but if it's really a pain, then use a label with the same image and handle the click event.
|
|
|
|
|
Hi there,
I am a student and want to develop a component or control as part of my application; which sends the emails to user at it’s i.e. without the intervention of user. For example, user set a date in system to send email to a@b.com and control should send the email on that date to specified email address.
thanks in advance.
|
|
|
|
|
I tried egghead.
Not much help.
I am trying to bind the records from the table to a datalist control in C#
private DataSet BindTBCOMMANDTYPE()
{
OdbcConnection myConnection = new OdbcConnection("DSN=POS;UID=systemWD=system");
// Populate the ddlDataSet1
myConnection.Open();
const string strSQLDDL = @"SELECT DT_REF, DT_DESCRIPTION FROM TBCOMMANDTYPE ORDER BY DT_REF";
OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL, myConnection);
ddlDataSet1.Clear();
myDataAdapter.Fill(ddlDataSet1, "ddlDATATYPE");
DataSet1.DataSource = ddlDataSet1;
DataSet1.DataBind();
myDataAdapter.Dispose();
myDataAdapter = null;
myConnection.Close();
return ddlDataSet1;
}
Just need the correct syntax.
http://www.eggheadcafe.com/forums/ForumPost.asp?ID=14586&INTID=6
Let's share our knowledge together!!!
mcupryk@sun.net.bb
Matt Cupryk
514-685-0449
|
|
|
|
|
Here's how you do it:
ListBox lb = new ListBox();
lb.DataSource = ds; // you data set
lb.DisplayMember = ""; //name of field being displayed
lb.ValueMember = ""; // name of field for value
More information: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformslistcontrolclassdatasourcetopic.asp
Jez you even have your phone numbers and everything. Do you get much calls?? lol.
|
|
|
|
|
I am sorry, I would like to add the Edit into the below code.
If you need any other code like the .cs I can send you anything.
I am so tired. I need your help on this one. I really appreciate it.
I am doing the following:
<br />
<form id="Form1" runat="server"><br />
<table width="100%"><br />
<TBODY><br />
<tr><br />
<td width="50%"><br />
<ASP:DataList id="MyDataList" runat="server"><br />
<ItemTemplate><br />
<table cellpadding="10" style="font: 10pt verdana"><br />
<tr><br />
<td><br />
Object ID:<br />
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "CM_REF")) %></br><br />
Description:<br />
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "CM_DESCRIPTION")) %></br><br />
Name:<br />
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "CM_OBJECTNAME")) %></br><br />
Timeout:<br />
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "CM_TIMEOUT")) %></br><br />
Type:<br />
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "CM_TYPE")) %></br><br />
Content:<br />
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "CM_CONTENT"))%></br><br />
Prepared:<br />
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "CM_PREPARED")) %></br><br />
Connection ID:<br />
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "DB_REF")) %></br><br />
</td><br />
</tr><br />
</table><br />
</ItemTemplate><br />
</ASP:DataList><br />
</form><br />
<br />
|
|
|
|
|
Sorry I didn't completely read everything the first time. Turns out that its an ASP.net thing. Well well... Set DataSource of your DataList to your DataSet. Then in the DataList template use: <%#Container.DataItem("fieldname")%>
Also make sure you call DataBind(). Otherwise nothing happends
|
|
|
|
|
<small><b>AK wrote:</b></small>
<i>Set DataSource of your DataList to your DataSet. Then in the DataList template use: <%#Container.DataItem("fieldname")%></i>
Can I can use this to display
<EditItemTemplate>
<asp:TextBox Runat="server" ID="editUserName" Text = '<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"USERNAME")) %>' Width="150">
</asp:TextBox>
</EditItemTemplate>
edit a textbox with datalist?
Thanks Matt
|
|
|
|
|
I do have a text box where I am typing some text. I want to handlee the keypress event. I don't have any problem with that. In my program, I do have two array like
array x contains something like
ex
btw
will
and array y contains
example
by the way
williams
Basically what I want, when I type "ex" in the textbox it must be replaced automatically by "example", "will" by "williams" etc.
I want to know how can I handle that. I am new to c#, I can watch for a single key using the KeyPressEventArgs, so how can I hadle multiple keys. I don't know much about dictionary object in c#. I will appreciate your help.
|
|
|
|
|
Well this is weird but you can do this...
Instead of using two arrays use a Hashtable:
Hashtable h = new Hashtable();
h.Add("ex", "example");
Handle the TextChanged event and then do a check:
if (h.ContainsKey(textbox.Text))
textbox.Text = h[textbox.Text];
|
|
|
|
|
I received an error from the following line of code
textbox.Text = h[textbox.Text];
I received an error CS0029,
Cannot implicitly convert type 'type' to 'type'
So it seems like you made a mistake in the line above
|
|
|
|
|
Sorry I was doing this of the top of my head. Just cast to string to fix this:
textbox.Text = (string)h[textbox.Text];
|
|
|
|
|
Your solution works for a single line of text. For instance if my textbox is a single line, when I type "exp" it is replaced by example. However for a multiple line, I need to handle more events. I am looking at something like that, the user is typing in a multiline text box, whenever he/she types "exp" in a sentence, it will be replaced by example. In that case, I think I have to work on the kepress event to see if the spacebar and the enter key have been press. For example if the user hit spacebar after "exp" then it will be replaced by "example", the same as if the user press enter after typing "exp". So how do I handle the keypress even in order to do that. I can use a condition to check if for space and enter key which are char(13) and char(20).
|
|
|
|
|
i wrote a stock Count Application with C#, i didn't have any problems to run my application on XP and 2000, but i did on NT.
when i run the application it working but when i try to Update data to stock.dbf i get error dialog box.
only on NT 4
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Data.OleDb.OleDbException: Operation must use an updateable query.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at Stock.frmEdit.btnSave_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.DirectoryServices
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.directoryservices/1.0.5000.0__b03f5f7f11d50a3a/system.directoryservices.dll
----------------------------------------
System.Messaging
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.messaging/1.0.5000.0__b03f5f7f11d50a3a/system.messaging.dll
----------------------------------------
System.ServiceProcess
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.serviceprocess/1.0.5000.0__b03f5f7f11d50a3a/system.serviceprocess.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
Stock
Assembly Version: 1.0.1739.29870
Win32 Version: 1.0.1739.29870
CodeBase: file:///D:/Aloha/stockControl/Stock.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/winnt/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
|
|
|
|
|
Did you installed MDAC for your NT OS? I mean Microsoft Data Access Component. If no please install MDAC 2.0 and try to execute the application.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Actually, .NET 1.0 required MDAC 2.6 and 1.1 required 2.7, but you're probably right about his problem.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hi, I'm doing my first deployment project and I want to put a shortcut to my application. I've done exactly what they say in MSDN (Walkthrough: Deploying a Windows Application), and my installer installs a shortcut, but when I click on it, a small Windows Installer window appears, seems to set up a few things and then starts my program.
How can I make a shortcut that simply starts my application?
Thanks!!
|
|
|
|
|
After adding project output files in application folder. You can view a file called 'Primery Output from yourprojectname'. Right click this file and choose 'Shortcut to Primary output from your project(Active)'. Choose that and give required name for shortcut. Then if you drag and droup this file to Users Desktop Folder then you will get a shortcut in desktop or if you choose the users Programming Folder then you shortcut will come in Program Menu.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
I've had done everything you specified above, but as I said, the shortcut does appear but when I click on it, instead of running my application, it seems to run some kind of Windows Installer window, even though my application is already installed. Some progress bars appears on this window and after (I beleive) re-installing my application, it runs it.
It looks like the shortcut that has been created is a shortcut to the Installation Program. If I remove the CD from which I ran the installer, I can't run my software from the shortcut, it says that the installation CD is not there.
Now I would like to get rid of this Windows Installer window.
Thanks
|
|
|
|
|
This is the expected behavior of Windows Installer if some component of your program is missing. Your shortcut isn't a normal shortcut; it contains custom shell data that has Windows Installer (MSI) check for missing components.
More than likely, you've included some files you probably shouldn't have in your installer. Perhaps these are sample files that get deleted or something. Make sure for these files you set the Vital property to False and that should solve the problem.
More can be done, but not with the Visual Studio Windows Installer projects, which are extremely limited. You can either use Orca from the Windows Installer SDK (part of the Platform SDK[^]) to modify the MSI package database if you know how (read the SDK documentation) or get a commercial package like Wise for Windows Installer[^] or InstallShield Developer[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|