|
You cannot disable part of the text in a textbox. You will have to handle TextChanged yourself.
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
Create your own class similar to...
public class picno
{
private int _PictureNumber;
public int PictureNumber
{
get { return _PictureNumber; }
set { _PictureNumber = value; }
}
public override string ToString()
{
return "Picture " + _PictureNumber.ToString() + " Inserted";
}
public picno(int PictureNumber)
{
_PictureNumber = PictureNumber;
}
}
then, when a picture is selected, create an instance of this assigning the picture number to the property and update the text. Something like...
picno myPicNo = new picno(25);
textBox1.Tag = myPicNo;
textBox1.Text += textBox1.Text + " " + (picno)textBox1.Tag;
On the text changed event, look to see if the alteration would change any text that matches (picno)textBox1.Tag and disallow if needed.
(You may need to use (picno)textBox1.Tag.ToString() for some operations)
modified on Wednesday, February 06, 2008 6:41:19 AM
|
|
|
|
|
Hey all,
In a lottery system website what are the things to keep in mind?
So far I thought about:
SSL to secure the client/server connection
Login site to authenticate and authorize the people working for the lottery place.
Database to store all the info.
The application itself, which by the way, would it be possible to make this website interface look like a desktop form?
It has to be a website type application because it needs to be OS independent. It has to run in a Unix Computer as well as in a Nintendo DS and everything in between.
Where can i get some c# scripts tutorials/books? I have googled it but I haven't been lucky so far.
I have a solid php/apache/mysql/javascript base but I am like quick sand in asp/IIS/Sql Server. I know the basics of Sql Server but so far it gets frustrating.
But I have learned my lesson you guy taught me, always work with the best and the best tools if you want to be part of the elite.
thanxs all!!!!
PS: this is the random question: which one is better asp or php, IIS or Apache, Javascript or C# scripts or vbscripts, python or c# or VB or Java?
And what is the difference between J# and C# because all examples i see in MSDN look the same to me!
Luis E Tineo S
|
|
|
|
|
Hi,
I am using Windows authentication and I get the current user like this:
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);<br />
WindowsPrincipal myPrincipal = (WindowsPrincipal)Thread.CurrentPrincipal;<br />
<br />
Response.Write(myPrincipal.Identity.Name + "<br /><br />");
I get the current groups like this:
foreach (IdentityReference idref in WindowsIdentity.GetCurrent().Groups)<br />
{<br />
Response.Write(idref.Translate(typeof(NTAccount)).Value + "<br />");<br />
Response.Write(idref.Translate(typeof(NTAccount)).Value + "<br />");<br />
}
What I need to find out is if the user belongs to any of these groups. How do I test this?
Please can some one help?
Regards,
Brendan
|
|
|
|
|
hi, I'm having a problem in declaring and passing a value to a public variable in C#.Net. I am a VB.Net user not a C#.Net user, i just thinking if i convert my VB.Net code to C#.Net and that's what I'm doing now.
In VB.Net you can create a Module where you can declare all your public variables to use it again and again. My problem now is, how can i declare a public variable/s in C#.Net so that i can use it for many times and also to pass a value to that variable so that i can get the value i pass to public variable.
Example.
Public strFullName as String , where strFullName is the variable where i pass the FullName of the person who logged to the system.
Thank You.
Don't block the drive way of all the newbies in programming.
|
|
|
|
|
Google not working for you?
class YourClass
{
public string fullName;
}
Having said that, using public variables is a Bad Thing. You should use properties instead.
class YourClass
{
private string _fullName;
public string FullName
{
get { return _fullName; }
set { _fullName = value; }
}
}
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
what's wrong with this?
code of Class
class getUserName<br />
{<br />
private String _UserName;<br />
<br />
public String UserName<br />
{<br />
get<br />
{<br />
return this._UserName;<br />
}<br />
set<br />
{<br />
this._UserName = value;<br />
}<br />
}<br />
}
code of Button 1 in Form 1
i put the "myUsername" to Username inside the getUsername class so i can get the Username whereever i open a different form.
private void button1_Click(object sender, EventArgs e)<br />
{<br />
getUsername objgetUsername = new getUsername();<br />
<br />
objgetUsername.UserName = "myUsername";<br />
}
code of Button 2 in Form 2
here i will retrieve the myUsername to put it in the Messagebox to show the Username i used.
private void button2_Click(object sender, EventArgs e)<br />
{<br />
getUsername objgetUsername = new getUsername();<br />
<br />
MessageBox.Show(getUsername.UserName);<br />
}
my problem now is, I'm getting a null value in Form 2 Button 2 everytime i click the Button 2. Any help out there.
Thank You.
if(you type your code here) {
Messagebox.Show("You help me a lot!");
}
else {
You help me = null;
}
|
|
|
|
|
Simple - the two objects you create in the two methods are different.
Anyway, this is wrong on so many levels. Your classes should be nouns, not verbs. Also, you don't even need a new class to store the user name in this case. In your form, just declare private string _userName; Then, in your methods, you can read and modify _userName directly.
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
hi
i open my .mdb file from c# with system.diagonistics.proccess.start()
but i donot know how open it exclusive
i try to send the argument : /excl but it donot open exclusive
please help me
p00932004@yahoo.com
parastoo saadat
|
|
|
|
|
Hello!
You want to open it in MS ACCESS or open for data-access?
In second case, you have to connect to it using MS ACCESS driver/connection string. For connection-string visit ConnectionStrings.com.
Regards,
Adeel
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
|
|
|
|
|
hi all
iam having a grid in my application which has 4 columns of which 1 column i set visible=false.i want to bind the value of that column to the textbox.since the bound column is not visible the data is not coming in the textbox.can anyone tell me how to bind the data.
pintoo
|
|
|
|
|
Hi Chithra!
You must have some DataSource to bind a Grid. So directly set that column value to the TextBox.
Suppose you have DataTable as DataSource then try this.
DataTable dt = new DataTable();
if(dt!=null)
{
if(dt.Rows.Count>0)
{
TextBox1.Text = dt.Rows[0][4].ToString();
YourGrid.DataSource = dt;
YourGrid.DataBind();
}
}
I hope this will help you.
Regards..
"Save water,It's precious"
|
|
|
|
|
hi
thanx for the reply.but i have binded the data already.i want to retrieve the data from the gridview but not from the data table directly(data is present in the grid but the visible property is set to false.)i want to retrieve the data from the grid.
pintoo
|
|
|
|
|
Hi Chithra!
Where is your TextBox resides? Inner side or outer side of GridView?
"Save water,It's precious"
|
|
|
|
|
hey
i got it..the text box was outside the grid only..actually i used a html input field and made that field in the grid hidden..iam giving the code here which i used.
and to retrieve the value
txt1.Text = ((HtmlInputHidden)GvPromotion.Rows[e.NewEditIndex].FindControl("DescHiddenValue")).Value;
pintoo
|
|
|
|
|
hey
i got it..the text box was outside the grid only..actually i used a html input field and made that field in the grid hidden..iam giving the code here which i used.
and to retrieve the value
txt1.Text = ((HtmlInputHidden)GvPromotion.Rows[e.NewEditIndex].FindControl("DescHiddenValue")).Value;
anyway thanx for sparing your time..
pintoo
|
|
|
|
|
You are Welcome!......
"Save water,It's precious"
|
|
|
|
|
Hi,
I have developed a Windows Contol and now I want to add multi language support so that my control user (the developer) will be able to create a sattelite assembly and place the assembly to appropriate folder in his application. But I can I convert my control so that it can load string from sattelite assembly, moreover, how can I set the option to my control so that the language can be set or automatically set by the operating system ! 0r by the developer (manually). I searched in Google, but I am not getting any easy direction, all articles are talking about either how to create sattelite assembly or how to set different culture. But my problem is realted to Custom Control where I dont have headache of creating sattelite assemblies, rather I want to give the option to my control user to use sattelite assembly/
Please help.
|
|
|
|
|
I have an input class in my XNA game, and I call a method from that class to the main class, to exit the game.
(Basically)
class Game1 : XNA.blah,blah,blah<br />
{<br />
<br />
Input input;<br />
<br />
void Initialize()<br />
{<br />
input = new Input();<br />
}<br />
<br />
void Update(GameTime gameTime)<br />
{<br />
input.CheckInput();<br />
}<br />
}<br />
<br />
public class Input : Game1<br />
{<br />
public void CheckInput()<br />
{<br />
if (Keyboard.GetState().IsKeyDown(Keys.Escape))<br />
{<br />
this.Exit();<br />
}<br />
}<br />
}
*there's more code, but that's not the issue; regualr stuff it starts with
So, how would I make the game exit from a different class? Thanks.
- I love D-flat!
|
|
|
|
|
public class Game1{
private Input mInput;
public Game1(){
mInput = new Input(this);
}
}
public class Input{
private Game1 mGame;
public void CheckInput(){
mGame.Exit();
}
public Input(Game1 game){
mGame = game;
}
}
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
I am attempting to create a structure that I would like to call sizeof(myStruct) to return 16. However, when I attempt to make this call from code, I get the error,
'myStruct' does not have a predefined size, therefore sizeof can only be used
in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf) I searched online, and the only note that I found was someone who stated that, because the CLR determines the layout of the structure at runtime, the size of myStruct cannot be determined at compile time. Due to this comment, I thought that I could include the following attribute on my structure to solve this problem:
[StructLayout(LayoutKind.Sequential, Pack = 8, Size = 16)]
public struct myStruct : IEquatable<myStruct>, IComparable<myStruct>, IComparable {
...
} However, this results in the same error. There has to be a way for me to do this, as the built-in types int, float, etc. all allow this method call without throwing an exception. Another issue that I think is related is that I cannot declare a constant of type myStruct. If anyone has some insight into either of these problems, I would appreciate some help. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
So use an unsafe context, big deal.
|
|
|
|
|
Ok, but lets say that I am running it within a web service on a server that I don't control, and the server doesn't allow unsafe code to run?
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
In that case what would you do with sizeof?
|
|
|
|
|
I have a collection that I wrote that has a statement at the top as follows:
using BaseType = SomeStructTypeHere;
...
public class Foo : ... {
...
private const int c_Size = sizeof(SomeStructTypeHere) << 3;
private static readonly int c_Bits = MathExtension.Log2(c_Size);
...
} I did this for maintenence purposes, so I could modify the 'Foo' class as necessary to use one of any number of structures as the base type for the class (changing the base type only changes the hard limits on the class, but NOT its functionality). This class is being used in a web service, and therefore cannot use unsafe code, as I have explained. I would now like to use the 'Foo' class with my type as 'BaseType'. How can I go about doing this? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|