|
in the last case he doesn't give my param the value of "val"
|
|
|
|
|
|
he is my program
this is the code i use now
<codeval;
if( textbox2.text="" !="string.Empty" )=""
val="textBox2.Text;
else" "%";dbanbm_t075_borgtochttableadapter.connection.connectionstring="dBANBM_T075_BORGTOCHTTableAdapter.Connection.ConnectionString.Replace(" ":param3",="" val="" );<="" code="">
the "val" get's his value form the program. that is the % if the field is empty. or else the value that is typed in the textfield.
but the parameter doesn't get this value
|
|
|
|
|
Hi guys!
need some Help ..
i m trying ti assign values to a resized string array without loosing its old values..
something like this:
string[] myArr=new string[]{"abhinav","gupta"};
Array.Resize(ref myArr, myArr.length+10}
this code increases the length of array
but how to assign the value of the new added Dimensions..without loosing the old values:
i dont want to use :
myArr[3]="some Text";
as the array is dynamic .. and i have to assign more than 50 values in different situations..
is there some other way to asign the values to new increased Dimensions...
abhinav
|
|
|
|
|
Use an ArrayList or if you use 2.0 the equivelant is List<String>
|
|
|
|
|
I am doing a project on binary trees, I need to show very large tree structure graphically on screen, How can make it in c#?
shiva
|
|
|
|
|
Well the easiest way would be with a TreeView control.
You can look at my ThreeTree program to see how you can add nodes to the TreeView control.
Or ware you thinking on drawing the tree yourself?
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi, Thanks 4 reply
Yes, I am thinking of drawing tree it self, as it shown in text books.
I hope i can do it with GDI+,..But not sure.
-- modified at 3:23 Tuesday 2nd May, 2006
|
|
|
|
|
You can doo it with GDI+. I was trying to do draw my tree about a week ago, but then I decided to use the TreeView control.
Drawing a tree seems very complex, as nodes would quickly overlap...
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi,
Can U please send me some sort of rough code, so i may modify and make it.
It may help me.
Thank U.
Shiva
|
|
|
|
|
Code that does what?
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
|
I think you missunderstood me. I didn't write a program that would manually draw the tree, I just used the TreeView control.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Ok, Sorry i misleaded
Thank U
|
|
|
|
|
Hello,
I am stuck on a Collection class in which my code is apparently overwriting the previous entries whenever an 'Add' is performed. I imagine I am overlooking something or implementing something incorrectly, but I have been unable to locate my problem. Any assistance will be greatly appreciated.
Note that I fealt this was a problem with the instantiation of the item contained within the collection class, but I create a new instantiation within the while loop. Additionally, I have tried this from outside the class and within the class. The class is to determine the email addresses and group names contained within a comma-delimited string of text ( in this case the txt_To.Text ).
The code that I feel to be relevant ( though it may be too much ) is as follows:
Collection Class code:
using System;
using System.IO;
using System.Collections;
namespace Direct_Mailer.Classes
{
public class Address_List : CollectionBase
{
private static string
_Name = null;
public Address_List()
{
}
public Address_List( string Name )
{
_Name = Name;
}
#region Address List Methods
#region Standard Methods
public Address this[ int index ]
{
get
{
return ( Address )List[ index ];
}
set
{
List[ index ] = value;
}
}
public int Add( Address value )
{
try
{
return List.Add( value );
}
catch( Exception this_Exception )
{
throw new Exception( "Add to the Address List failed.", this_Exception );
}
}
public void Insert( int index, Address value )
{
try
{
List.Insert( index, value );
}
catch( Exception this_Exception )
{
throw new Exception( "Insertion into the Address List failed.", this_Exception );
}
}
public void Remove( Address value )
{
try
{
List.Remove( value );
}
catch( Exception this_Exception )
{
throw new Exception( "Removal from the Address List failed.", this_Exception );
}
}
public int IndexOf( Address value )
{
try
{
return List.IndexOf( value );
}
catch( Exception this_Exception )
{
throw new Exception( "Attempt of IndexOf failed in Address List.", this_Exception );
}
}
public void CopyTo( Address[] Address_Array, int index)
{
try
{
List.CopyTo( Address_Array, index );
}
catch( Exception this_Exception )
{
throw new Exception( "The CopyTo method failed in Address List.", this_Exception );
}
}
#endregion
#region Class Specific Methods
public string Name
{
get
{
return _Name;
}
set
{
_Name = value;
}
}
static private Address this_Address = new Address();
public Address_List generate_List( string comma_delim )
{
int begin_pos = 0,
comma_pos = 0,
amp_pos = 0;
try
{
while( comma_pos >= 0 )
{
comma_pos = comma_delim.IndexOf( ',', comma_pos );
if ( comma_pos <= 0 )
this_Address.address = comma_delim.Substring( begin_pos);
else
this_Address.address = comma_delim.Substring( begin_pos, comma_pos - begin_pos );
this_Address.address.Trim();
amp_pos = this_Address.address.IndexOf( '@' );
if ( amp_pos != -1 )
this_Address.type = Address.Type.Address;
else
this_Address.type = Address.Type.Group;
List.Add( this_Address );
if ( comma_pos >= 0 )
begin_pos = amp_pos = ++comma_pos;
}
return this;
}
catch( Exception this_Exception )
{
throw new Exception( "Error occured attempting to generate an Address List.", this_Exception );
}
}
#endregion
#endregion
}
}
From the item class the Collection class contains:
using System;
using System.IO;
namespace Direct_Mailer.Classes
{
public class Address
{
public Address()
{
}
public enum Type
{ Address, Group };
private static string
_address = null;
public string address
{
get
{
return _address;
}
set
{
_address = value;
}
}
private static Type _type = 0;
public Type type
{
get
{
return _type;
}
set
{
_type = value;
}
}
}
}
From the function on the form that accesses the collection:
private void btn_Send_Click(object sender, System.EventArgs e)
{
Address_List To_List = new Address_List();
if ( txt_To.Text.Length <= 0 )
{
MessageBox.Show("This email has not been addressed to anyone", "Direct Mailer", MessageBoxButtons.OK, MessageBoxIcon.Exclamation );
txt_To.BackColor = Color.LightCoral;
return;
}
To_List.generate_List( txt_To.Text );
txt_Body.Text = "Listing produced the following:";
for ( int counter = 0; counter < To_List.Count; counter++ )
{
txt_Body.Text += "\n\t" + To_List[ counter ].address
+ "\t" + To_List[ counter ].type.ToString();
}
}
Far better to keep one's mouth shut
_ and appear stupid
than to open one's mouth
_ and remove all doubt.
I rarely follow this.
|
|
|
|
|
I’m new to .NET and HTML programming …
I’m trying to automatically (programmatically) select an entry in a HTML table. I’m using C# and .NET and the WebBrowser Class.
I can automatically log in by doing
HtmlElement userElem = doc.GetElementById("signin:user");
userElem.InnerText = this.m_username.Text;
HtmlElement pwElem = doc.GetElementById("signin:password");
pwElem.InnerText = this.m_password.Text;
HtmlElement btnElem = doc.GetElementById("signin:signinbtn");
btnElem.InvokeMember("click");
I have a table I need to process which looks like:
<TABLE id="Table1" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr>
<td class="TopBorder"></td>
<td class="TopBorder" align="right" width="1000"></td>
<td class="TopBorder" vAlign="top" align="right" width="1"></td>
</tr>
<tr height="6">
<td></td>
</tr>
<TR>
<TD vAlign="top" width="1" rowSpan="3">
<SELECT size="2" onchange="UpdateTable(event)" style="FONT-SIZE: xx-small; WIDTH: 200px; font-family: Verdana, Helvetica, sans-serif;"
id="lbInList">
<OPTION style="BACKGROUND-COLOR: LemonChiffon" value="303294000">OPTION 1 </OPTION>
<OPTION style="BACKGROUND-COLOR: PaleGreen" value="366779420">OPTION 2 </OPTION>
</SELECT>
</TD>
</TR>
</TABLE>
Ive tried but get no selection: Any ideas what i'm doing wrong?
HtmlElement Table = doc.GetElementById("Table1");
HtmlElement Info = doc.GetElementById("lbInList");
Info.SetAttribute("value", "303294000");
Info.InvokeMember("select", "1");
|
|
|
|
|
In JavaScript you would have to set the OPTION's selected property to true.
|
|
|
|
|
Thanks! & One step closer
HtmlElement Table = doc.GetElementById("Table1");
HtmlElement Info = doc.GetElementById("lbInList");
Info.SetAttribute("selectedIndex", "4");
Info.InvokeMember("change");
Now yields the 4th item being selected, but the "onchange" event doesn't seem to fire. Ive tried
Info.InvokeMember("click"); as well but it doesnt invoke the onchange="UpdateTable(event)" script.
Any more insight?
|
|
|
|
|
Hi!
I have a file (input.txt) which contains:
1 2 7 4 5
6 7 8 9 0
33 64 0 6 7
I want to read this file's contents and sort each row by increasement. Then write again in a new file (output.txt)which will contain:
1 2 4 5 7
0 6 7 8 9
0 6 7 33 64
Thanks!
|
|
|
|
|
And what is the problem?
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
using System;
using System.IO;
namespace MyApplication
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
if(File.Exists("output.txt"))
{
File.Delete("output.txt");
}
StreamReader streamReader = new StreamReader("input.txt");
StreamWriter streamWriter = new StreamWriter("output.txt");
while(true)
{
try
{
string[] texts = streamReader.ReadLine().Split(' ');
int[] numbers = new int[texts.Length];
for(int i = 0; i < texts.Length; i++)
{
numbers[i] = Int32.Parse(texts[i]);
}
Array.Sort(numbers);
string newString = "";
for(int i = 0; i < numbers.Length; i++)
{
newString += numbers[i].ToString();
if(i != numbers.Length - 1)
{
newString += " ";
}
}
streamWriter.WriteLine(newString);
}
catch
{
break;
}
}
streamReader.Close();
streamWriter.Close();
}
}
}
|
|
|
|
|
I'm trying to get the document properties: Title, Author, etc of a document. I can find great documentation on Microsoft Office documents, but I need to do it for all documents. I think the solution will use the MODI library. Any help is greatly appreciated.
|
|
|
|
|
I'm in the process of building my first n-tier software package. However I'm kind of stuck on a design decision. I posted in the C# forum since this is the language I am using, however the responses will most likely be algorithmic and language agnostic.
So here is the issue (VERY basic) I'm sure...
Each user needs to be logged into the program in order to use it. I'm going to use a basic username/password authentication scheme however, how would I implement this? I've never done anything like this before and I am not a professional. My first idea was to keep a SQL2005 table of users with information for each user such as password and other personal information. I was going to use SqlCommand() to do a select query where the username and password match on a character by character basis. Is this the best, or at least an "ok" way to do this? How is authentication "normally" implemented using .NET?
Thanks,
John
|
|
|
|
|
I am not sure I would say anything is the normal way.
Username/Password is common, but never store or send the password in clear text. Encrypt it in some way, MD5 hash is common but can be broken (as most methods can be. Another option is if all machines are on the same domain. Use windows authentication, this fails if users leave and do not password lock their machines however. In some cases I have also read machine information (mac address, etc.) and allow user X to only come via machine y. Depends on what you are looking for.
In any event, along with the username/password fields have fields for last login time/date and number of login failures. If unused for x days, lock the account or if x unsuccessful attempts also lock the account.
"Every new day begins with possibilities. It's up to us to fill it with things that move us toward progress and peace.” (Ronald Reagan)
|
|
|
|
|