|
Actually I need that one.Can you please tell me how to do
|
|
|
|
|
I have a control that expands when pressed. My question is how do I manange/move the other controls so nothing overlaps.
Also, how can I add a checkbox to a label before Text label. When I add it to label.Controls I just see the checkbox.
And last thing, in my class, I have label.autosize = false;
but when I add that control to the form, the VS 2005 sets the autosize property to true.
Thanks
|
|
|
|
|
There is no built in support for laying out controls. What you can do is derive from ContainerControl and catch the resize event for all the contained controls. When resize occurs you determine if you need to perform layout. If you do need to perform layout u can do something like this (psuedo-code):
int currentx;
int currenty;
foreach(control c in this.controls)
{
c.location = new point(currentx, currenty);
increment currentx and current y
}
>> how can i add a checkbox to a label
Whats the point of doing that?
|
|
|
|
|
|
I have a need to be able to automatically launch a VPN connection to a customer's site to allow me to download a file and process it. I would like to use C# to build a task or service to perform this. Does anyone have any examples of automatically launching the VPN connection and disconnecting the connection after the file is processed?
Thanks
|
|
|
|
|
You can P/Invoke the WNet APIs like WNetConnectionDialog (to prompt) or P/Invoke WinInet APIs like InternetAttemptConnect , all of which are documented in the MSDN Library Online[^].
We've also discussed this before on the forum. I encourage you to click "Search comments" above and try searching for keywords like "WinInet".
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I am trying to develop an IE plugin that
a- Show its Icon on the toolbar
b- Interact with IE and record every site the user goes to.
Any ideas
P.S. Dont be concerned, im not interested in writing spyware. Im more concerned with getting the IE COM model to interact with C# and logging every http request is one way i know that its working.
|
|
|
|
|
Take a look at some of the articles on the following search: http://www.codeproject.com/info/search.asp?cats=3&cats=5&searchkw=band[^].
You don't really need a toolbar button, though. You can accomplish this most easliy using a native COM server called a Browser Helper Object. In fact, an article on MSDN even does what you want: each time an HTML resources is downloaded it fills a little tool window with the content (using the DOM to a degree). Read Browser Helper Objects: The Browser the Way You Want It[^].
You should also read Creating Custom Explorer Bars, Tool Bands, and Desk Bands[^]. Note that because these all require COM clients and servers that use defined interfaces, it's often easier to write your add-ins in native (unmanaged) C++; otherwise, you have to properly declare your COM interfaces in C#, declare the necessary structs correctly, define constants, and sometimes P/Invoke native functions to get your managed code to work - quite a bit of overhead.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
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];
|
|
|
|