|
<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]
|
|
|
|
|
Hi I have an image of 45 mb.It is not possible for me to store in a picture box .Is there any way to cut an image part by part & the same image can be pasted without any pixel difference.
Any help would be appreciated
|
|
|
|
|
|
I put a image in asp .net. Now i need to get the property of the image using C#. help me, how to do this
|
|
|
|
|
Once you get the Image object you can get values from the Width and Height properties. A few other are available if you look deeper: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingimageclasstopic.asp
|
|
|
|
|
Just i need to get Visible property only
i declare 2 images within datagrid like
<asp:datagrid id="dGrid" Width="50%" AutoGenerateColumns="False" Runat="server">
<Columns>
<asp:TemplateColumn ItemStyle-Width="10%">
<ItemTemplate>
<asp:Image ID="imgPlus" Runat="server" ImageUrl="iimages\plus.gif"></asp:Image>
<asp:Image ID="imgMinus" Runat="server" ImageUrl="iimages\minus.gif"></asp:Image>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
Now i can't get the image using id in C#, I asked, how can i get that images id or visible property in C#.
|
|
|
|
|
hello
i have aproblem here mixing RGB rays to produce colors??
i wanna to draw a color triangle using this mixture??
if i cant explain the problem told me to more explanitions
thx
|
|
|
|
|
So you want to draw an equilateral triangle like so:
R
*
***
*****
G ******* B
excuse the crappy ascii graphics
So the red componant of each pixel will depend on how close it is to the R point, the green componant on the distance from G and the blue point from it's distance from B.
Working these out is fairly straightforward using high school trig
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
look u have to know that the center of the triangle is white(255,255,255)
and there is no function draw pixel or points in windows application so plz help
thx
|
|
|
|
|
To draw pixels (assuming you're working on a Windows Forms project), place a PictureBox control on your form, create a Bitmap object in your code, then pass the PictureBox the bitmap using it's Image property
You can then use the bitmaps SetPixel member to plot points
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
A PictureBox is a lot of overhead (no need for an in-memory bitmap to get blitted to the on-screen bitmap) and it's often better to encapsulate your controls rather than using whatever you can find. This gives you much more control over what the control does.
To the original poster: In this case, the PathGradientBrush can be very effective when overriding OnPaint of your own control. There's a lot of documentation you should, read, however, which can be found at http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDrawingDrawing2DPathGradientBrushClassTopic.asp[^]. It - along with related classes - can calculate the gradient for you, if that's what you're trying to do.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Take a look at the PathGradientBrush , the GraphicsPath , and related classes and structs. If I understand your question right, the sample below should work for you by encapsulating your triangle into a separate control (with a clipping region set to the triangle for your control as well).
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
class Test : Form
{
static void Main()
{
Application.Run(new Test());
}
Test()
{
Text = "Triangle Example";
Triangle t = new Triangle();
Controls.Add(t);
t.Dock = DockStyle.Fill;
}
}
class Triangle : Control
{
public Triangle()
{
SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint
| ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw, true);
UpdatePath();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (!init)
{
UpdateBrush();
init = true;
}
Graphics g = e.Graphics;
g.Clip = region;
g.FillPath(brush, path);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
UpdatePath();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (path != null) path.Dispose();
if (region != null) region.Dispose();
if (brush != null) brush.Dispose();
}
}
GraphicsPath path;
Region region;
void UpdatePath()
{
PointF p1 = new PointF(Width / 2, Top);
PointF p2 = new PointF(0, Bottom);
PointF p3 = new PointF(Width, Bottom);
if (path != null)
{
path.Dispose();
path = null;
}
if (region != null)
{
region.Dispose();
region = null;
}
path = new GraphicsPath();
path.AddPolygon(new PointF[] {p1, p2, p3});
region = new Region(path);
if (init) UpdateBrush();
}
PathGradientBrush brush;
bool init = false;
void UpdateBrush()
{
if (brush != null)
{
brush.Dispose();
brush = null;
}
brush = new PathGradientBrush(path);
brush.CenterColor = Color.Gray;
brush.SurroundColors = new Color[] {c1, c2, c3};
}
Color c1 = Color.Red, c2 = Color.Green, c3 = Color.Blue;
public Color C1
{
get { return c1; }
set { c1 = value; UpdateBrush(); }
}
public Color C2
{
get { return c2; }
set { c2 = value; UpdateBrush(); }
}
public Color C3
{
get { return c3; }
set { c3 = value; UpdateBrush(); }
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello,
I already looked in the articles but i did not found anyone. Does there not exist any article for PocketPc which works with tab pages - tab panes?
regards
pat
|
|
|
|