|
Hi, I want to ask if there is in .NET an similar technology to the Java Applet/Servlet. And if such a thing exists pls help me with some documentation resources.
Thanks a lot.
|
|
|
|
|
refer the following URLs
www.gotdotnet.com/team/compare
http://java.oreilly.com/news/farley_0800.html
Regards,
Amal
amal_forum@hotmail.com
|
|
|
|
|
I wrote an article a long time back on another site that I'm working on porting to CodeProject as a new series. See http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=388[^] for more information about hosting .NET controls in a web page. If exposed as COM control correctly (which the articles covers), you can even script them and handle events.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
|
How to read the current selected or clicked grid cell value as well as the whole row to which that cell belongs ?
Appreciate your help.
MSG: Life is whole learning experience.
|
|
|
|
|
Overriden CurentCellChanged event or :
dg[dg.CurrentCell.RowNumber,dg.CurrentCell.ColumnNumber]
Mazy
No sig. available now.
|
|
|
|
|
Thanks, Got it ..
Here it's:
.
.
MessageBox.Show((datagridBrowse[i,j])ToString());
.
.
Many Thanks 44.
Life is whole learning experience..
|
|
|
|
|
hi
i am currently writing an application where the user can save as much as he wants
those are splitted in A[] and B[] (String[])
a contains A name and B contains a path related to the name of A
i want that A will be shown in a listbox (all A's) and when you click on it i want a messagebox showing A and B together (the right one, e.g. A[5] and B[5]; not A[4] and B[2] or so)
i am open for all ways of saving, but i do not have an own idea how i can make this
thx
|
|
|
|
|
You can create a serialize class and encapsualte your class there and store your data in a XML file,for working with XML there are lots of projects in this site. Or if you do not want to store it in a XML,you can store that class in dat file.
Mazy
No sig. available now.
|
|
|
|
|
1) You can use a ListView instead of the ListBox, and store the path (B) in the .Tag property of each ListViewEntry. When you click a name (A), you can read the path from the Tag property:
for(int n=0; n
|
|
|
|
|
I have a windows application which has a lot of controls placed all over the screen. I have developed it in screen resolution of 1024 X 768.
The problem is that when the resolution becomes more, the controls occupy lesser space on the screen with lot of free area. If the resolution decreases, each control requires more space on the screen and many controls go out of the screen with scroll bars being displayed.
Is there a way of dynamically resizing the form controls based on the resolution of Windows?
Koos
|
|
|
|
|
First: There are many applications that they fir for one resolution and warn it before run. But beyond that after your InitializeComponent() add a method that set the methods based on this resolution. You can get the resolution with SystemInformation.VirtualScreen property,and every control has its own Size property.
Mazy
No sig. available now.
|
|
|
|
|
In addition to what Mazdak was talking about, you can also make use of the Dock property that most of the controls expose. Effective docking can help decrease those problems. If you're not starting with a clean surface, though, pay close attention to the order in which controls are added to the container's (ex: Form ) Controls collectoin. They must be added in reverse order. For instance, if you have the "explorer layout" like so:
+-+---+
| | |
| | |
+-+---+ , you'll want a TreeView , Panel (to further dock additional controls), or some other control set to <cod>DockStyle.Left, then a splitter, then another control with DockStyle.Fill . The order in which these are added are in reverse of how I mentioned them:
Controls.AddRange(new Control[]
{
panel2,
splitter1,
panel1
}); When you add these controls to the designer for the first time (i.e., on a "clean surface"), add them in the order that I first mentioned above. VS.NET automatically adds the most recently added control as the first control in the array above.
Just play around with docking a little bit. Anchoring to opposing sides is also helpful but while docking and anchoring share some behavior in common, they are also used to solve distinct problems (they are most like each other when anchoring against opposing and adjacent sides, but docking can't move a control relative to adjacent sides).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
DockStyle in IMO is the easy way out, if you want control, use anchors.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
The problem with anchors is that theyonly anchor to the parent control/form, and when the control/form shrinks the controls overlap.
The problem with docking is that the change in size is only shown in the fill'd control, and there is only one of these.
What you want is to have the control container resize the child controls, for that you need to create an "AutoSizePanel", have that dock'd fill and then set your controls on the panel.
Here is the code for the "AutoSizePanel":
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
namespace Workbench
{
/// <summary>
/// A panel that resizes controls automatically.
/// </summary>
public class AutoSizePanel : Panel
{
/// <summary>
/// Holds the control info.
/// </summary>
private Hashtable htInfo = new Hashtable();
/// <summary>
/// Flag to prevent recursive call.
/// </summary>
private bool bAllowResize = true;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
/// <summary>
/// Constructor.
/// </summary>
public AutoSizePanel()
{
InitializeComponent();
}
/// <summary>
/// Adds a control to the list of controls.
/// </summary>
/// <param name="e"></param>
protected override void OnControlAdded(ControlEventArgs e)
{
// Hold the resizing
bAllowResize = false;
// Create the original info
SizingInfo riData = new SizingInfo(e.Control);
// Add to table
htInfo.Add(e.Control, riData);
// BAck to normal
bAllowResize = true;
//
base.OnControlAdded (e);
}
/// <summary>
/// Removes a control from the list of controls.
/// </summary>
/// <param name="e"></param>
protected override void OnControlRemoved(ControlEventArgs e)
{
// Delete the info
htInfo.Remove(e.Control);
//
base.OnControlRemoved (e);
}
/// <summary>
/// Does the magic.
/// </summary>
/// <param name="e"></param>
protected override void OnResize(EventArgs e)
{
// Only once
if (bAllowResize)
{
// Set
bAllowResize = false;
// And apply to each control
foreach (Control ctl in this.Controls)
{
// Get the original info
SizingInfo riCtl = htInfo[ctl] as SizingInfo;
// Info available?
if (riCtl != null)
{
// Resize
riCtl.Resize(ctl);
}
}
// Reset
bAllowResize = true;
}
//
base.OnResize (e);
}
protected override void OnPaint(PaintEventArgs e)
{
// Hold the resizing
bAllowResize = false;
// Collect info
foreach (Control ctl in this.Controls)
{
// Get the original info
SizingInfo riCtl = htInfo[ctl] as SizingInfo;
// Info available?
if (riCtl != null)
{
// Update
riCtl.Update(ctl);
}
}
// Back to normal
bAllowResize = true;
//
base.OnPaint (e);
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// AutoSizePanel
//
this.Name = "AutoSizePanel";
this.Size = new System.Drawing.Size(232, 184);
}
#endregion
/// <summary>
/// This holds the original control information.
/// </summary>
private class SizingInfo
{
/// <summary>
/// Info to be kept.
/// </summary>
public int iTop;
public int iLeft;
public int iHeight;
public int iWidth;
public int iParentHeight;
public int iParentWidth;
/// <summary>
/// Constructor
/// </summary>
/// <param name="ctl"></param>
public SizingInfo(Control ctl)
{
// Save
this.Initialize(ctl);
}
/// <summary>
/// Updates the internal info
/// </summary>
/// <param name="ctl"></param>
public void Update(Control ctl)
{
// Compute the change.
double dRatioHeight = (double) ctl.Parent.Height / iParentHeight;
double dRatioWidth = (double) ctl.Parent.Width / iParentWidth;
// And where it would go.
int iWTop = (int) (iTop * dRatioHeight);
int iWHeight = (int) (iHeight * dRatioHeight);
int iWLeft = (int) (iLeft * dRatioWidth);
int iWWidth = (int) (iWidth * dRatioWidth);
// Changes?
if ((iWTop != ctl.Top) || (iWLeft != ctl.Left) || (iWHeight != ctl.Height) || (iWWidth != ctl.Width))
{
// Reset
this.Initialize(ctl);
}
}
/// <summary>
/// Does the magic
/// </summary>
/// <param name="ctl"></param>
public void Resize(Control ctl)
{
// Compute the change.
double dRatioHeight = (double) ctl.Parent.Height / iParentHeight;
double dRatioWidth = (double) ctl.Parent.Width / iParentWidth;
// And shake it
ctl.Top = (int) (iTop * dRatioHeight);
ctl.Height = (int) (iHeight * dRatioHeight);
ctl.Left = (int) (iLeft * dRatioWidth);
ctl.Width = (int) (iWidth * dRatioWidth);
}
/// <summary>
/// Saves the base info
/// </summary>
/// <param name="ctl"></param>
private void Initialize(Control ctl)
{
// Save
iTop = ctl.Top;
iLeft = ctl.Left;
iHeight = ctl.Height;
iWidth = ctl.Width;
iParentHeight = ctl.Parent.Height;
iParentWidth = ctl.Parent.Width;
}
}
}
}
This code is being made available to all freely.... Have fun, but do not copyright.
|
|
|
|
|
je_gonzalez wrote:
The problem with anchors is that theyonly anchor to the parent control/form, and when the control/form shrinks the controls overlap.
Hopefully at that stage the user realises that his an idiot, and the app wont run at 20 x 40 px.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
First, I am assuming that you have never dealt with marketing, as users are never idiots, and your app should run at 20 by 40. I solve it by making the controls really small, and then it becomes a hardware problem as the monitor is not able to display them properly.
Second, you should be PC and not assume that all users are male. This is assuming that you meant to type "the user realizes that he is an idiot", if not my apologies.
|
|
|
|
|
Please use C# to Print the following :
1
12
123
1234
12345
1235
124
1245
125
13
134
1345
135
14
145
15
2
23
234
2345
235
24
245
25
3
34
345
35
4
45
5
|
|
|
|
|
Console.WriteLine("1");
Console.WriteLine("12");
Console.WriteLine("123");
Console.WriteLine("1234");
Console.WriteLine("12345");
Console.WriteLine("1235");
Console.WriteLine("124");
Console.WriteLine("1245");
Console.WriteLine("125");
Console.WriteLine("13");
Console.WriteLine("134");
Console.WriteLine("1345");
Console.WriteLine("135");
Console.WriteLine("14");
Console.WriteLine("145");
Console.WriteLine("15");
Console.WriteLine("2");
Console.WriteLine("23");
Console.WriteLine("234");
Console.WriteLine("2345");
Console.WriteLine("235");
Console.WriteLine("24");
Console.WriteLine("245");
Console.WriteLine("25");
Console.WriteLine("3");
Console.WriteLine("34");
Console.WriteLine("345");
Console.WriteLine("35");
Console.WriteLine("4");
Console.WriteLine("45");
Console.WriteLine("5");
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
|
|
|
|
|
|
I love your reply. It's so humorful hah...
|
|
|
|
|
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Collections;
namespace CodeProject
{
class SillyStuff
{
[STAThread]
static void Main(string[] args)
{
ArrayList list = new ArrayList();
bool[] patt = new bool[] {false, false, false, false, false};
bool keeptruckin = true;
while (keeptruckin)
{
keeptruckin = false;
for (int loop1 = patt.GetLowerBound(0); loop1 <= patt.GetUpperBound(0); loop1++)
{
if (!patt[loop1])
{
patt[loop1] = true;
keeptruckin = true;
break;
}
else
{
patt[loop1] = false;
}
}
if (keeptruckin)
{
string buffer = string.Empty;
for (int loop2 = patt.GetLowerBound(0); loop2 <= patt.GetUpperBound(0); loop2++)
{
if (patt[loop2]) buffer += (loop2 + 1).ToString();
}
list.Add(buffer);
}
}
list.Sort();
for (int loop3 = 0; loop3 < list.Count; loop3++)
{
Console.WriteLine(list[loop3]);
}
Console.WriteLine("DONE");
}
}
}
|
|
|
|
|
You were subtle!
You got my 5!
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn
|
|
|
|
|
|
I want to add a text box into a template column during runtime. I can add a
boundcolumn but not with template column. I allow user to type in something
in the textbox in the datagrid. I wanna know if it's possible
public void AddNewColumn(DataGrid grid,string headerName)
{
TemplateColumn bc = new TemplateColumn();
............... something here
.................
grid.Columns.Add(bc);
}
Thanks
|
|
|
|