|
Yep. I've tried restarting the IDE and the computer but still the same.
|
|
|
|
|
The problem has to lie in the GetEnumerations method - though I can't imagine what could be in it that would cause the behaviour you're experiencing!
I'd put beakpoints all over that method to find out what's going on.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
See, that's the thing. I've already done that. Its not even accessing the method. It just reverts back to the MDI form's code. It just exits the Child's load event handler. The form displays fine and function alright (I checked other stuff in the form and it works perfectly fine).
Its driving me insane.
And I'm really sorry for the late reply but the electricity was out for a few hours.
|
|
|
|
|
Are you absolutely sure that the handler is being called at all?
Maybe you (or the designer) have deleted the line that adds the handler method to the delegate's invocation list, or a different method is in there?
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
OK. I went a few levels back and caught the very basic exception being thrown (it turns out that there is an exception being thrown!)
I'm getting a:
{System.TypeLoadException: Could not load type 'RCH.BL.Inventory.ItemCategory' from assembly 'BL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at RCH.Inventory.Forms.frmAddItem.GetEnumerations()
at RCH.Inventory.Forms.frmAddItem.frmAddItem_Load(Object sender, EventArgs e) in C:\Data\Work\Asclepius\trunk\src\Inventory\Forms\frmAddItem.cs:line 115}
Now why would this happen?
Thanks to JSOP for the tip! I'm posting this to him as well
|
|
|
|
|
Add a try/catch block around the call to GetEnumerations.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
OK. I went a few levels back and caught the very basic exception being thrown (it turns out that there is an exception being thrown!)
I'm getting a:
{System.TypeLoadException: Could not load type 'RCH.BL.Inventory.ItemCategory' from assembly 'BL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at RCH.Inventory.Forms.frmAddItem.GetEnumerations()
at RCH.Inventory.Forms.frmAddItem.frmAddItem_Load(Object sender, EventArgs e) in C:\Data\Work\Asclepius\trunk\src\Inventory\Forms\frmAddItem.cs:line 115}
Now why would this happen?
Thanks to your tip, I'm reminded how to find a bleeding error. Thanks.
|
|
|
|
|
Maybe you neglected to do a build all and then update all the assembly binaries.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I've done that at least a dozen times since I've found out the error.
As is, I'm at folks now so I'm working from my laptop and everything is fine on this machine. When I get back home to my proper dev box I'm going to try that again and see what the heck is going on.
Thanks for everything John
|
|
|
|
|
Hi all,
I want to find multiple occurrence of a string.
I used string.Contains() method and it returns only the first occurrence. I want to find how many occurrence and add some characters in that index. How can I do that?
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Contains() internally calls IndexOf() method...For finding the multiple occurrences use IndexOf() and loop through the entire string.
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
|
|
|
|
|
or have a look at Regex class. It may be more complex, it offers lots of functionality.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Try this:
string text = "one two three one oneone, someone for";
string wordToFind = "one";
int wordCount = 0;
int pos = 0;
while (pos >= 0)
{
pos = text.IndexOf(wordToFind);
if (pos >= 0)
{
wordCount++;
text = text.Substring(pos + wordToFind.Length);
}
}
The example above should result in a wordCount of 5.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Here's a variation of the answer I gave previously. In this example, I supply code to count instances of the exact word.
string text = "one two three one oneone, someone for";
string alphaNumbers = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
string wordToFind = "one";
bool caseSensitive = false;
int wordCount = 0;
int pos = 0;
string text2 = text;
if (!caseSensitive)
{
text2 = text2.ToUpper();
wordToFind = wordToFind.ToUpper();
}
while (pos >= 0)
{
pos = text2.IndexOf(wordToFind);
if (pos >= 0)
{
wordCount++;
text2 = text2.Substring(pos + wordToFind.Length);
}
}
wordCount = 0;
text2 = text;
if (!caseSensitive)
{
text2 = text2.ToUpper();
wordToFind = wordToFind.ToUpper();
}
string[] parts = text2.Split(' ');
foreach (string part in parts)
{
if (part == wordToFind)
{
wordCount++;
}
else
{
char lastChar = part[part.Length - 1];
if ((part.Length == wordToFind.Length + 1) && (alphaNumbers.IndexOf(lastChar) == -1))
{
wordCount++;
}
}
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi experts,
Would like to know if there any reviews on such software? thanks!
|
|
|
|
|
I don't percieve of how this is a programming question ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
i Have little bit experience in Bio-metric finger print modules.
i think u have to Use the Manufactures API's, For your Development.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Hi all,
I have an object called “Report” that I want to serialize.
The saved object will be open at IE browser.
I want to save object from C# code with line at the head:
<?xml-stylesheet href="Report.xslt" type="text/xsl" ?>
How I do that?
I used with XmlSerializer from microsoft.
var serializer = new XmlSerializer(typeof(Report), NameSpace);
writer = new StreamWriter(fullpath));
serializer.Serialize(writer, this);
The result is :
<?xml version="1.0" encoding="utf-8" ?>
<Report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/Report.xsd">
<StartDateTimeTest>22-9-2009 12:00:12</StartDateTimeTest>.....
And i want to get
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="Report.xslt" type="text/xsl" ?>
<Report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/Report.xsd">
<StartDateTimeTest>22-9-2009 12:00:12</StartDateTimeTest>.....
I am very desperate,
Thanks all.
Ido
|
|
|
|
|
I think on serialization only class members will be serialized...So the other way around is to Serialize the object to a string instead of serializing directly to a file...then you can insert the required stylesheet declaration string and afterwards load the formatted XML into a XML document and save it to a file.
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
|
|
|
|
|
|
Cheers
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
|
|
|
|
|
Hi guys, i have encountered a problem in finding control.
i have binded data to a label in a datalist to retreive a email and it works. but next, i have a new label by the name of "Testing". How do i grab the bound data from the label to put into a string?
Below will be the code i have on hand:
Part of the source code will be like
<asp:label id="Testing" text="<#% Eval(" email")%>"="" xmlns:asp="#unknown">
How do i grab the eval email value and put to a string? Kindly please help, thanks guys
|
|
|
|
|
looks like ASP to me - go there.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hey people. I am currently doing a social portal like Facebook. What i am facing over now is whenever a user makes an update, for example : Posted a new status or note.
Below, when pple click on the Note button, it will display the top 5 updates from the database. But this raises a question. Every update will have an UpdateID, but how do i actually know what updateID are they each.
This is because i allow other users to comment on each of these update. Without capturing the UpdateID, i will have trouble in inserting the right Comments onto the status or note.
Hope you guys understand what i am trying to intepret over here.
Source code
asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderStyle="None" Height="0px" Width="443px" GridLines="None" OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:TemplateField>
<EditItemTemplate>
<asp:TextBox ID="CommentText" runat="server" Text='<%# Bind("FullName") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<a href = ""><asp:Label ID="Label1" runat="server" Text='<%# Bind("FullName") %>'></asp:Label></a> wrote a note.<br /><br />
<asp:Label ID="Label2" runat="server" Text='<%# Bind("TextInput") %>'></asp:Label><br /><br />
<asp:Button ID="WriteComment" runat="server" Text="Write Comment" Visible ="true"/><br /><br />
<asp:TextBox ID="Notestxtbox" runat="server" Columns="36" TextMode="MultiLine" MaxLength="100" Height="60px" Width="304px" Visible ="False"></asp:TextBox>
<asp:Button ID="ViewComment" runat="server" OnClientClick="window.open('ViewComment.aspx','','left=100,top=50,width=500,height=500,scrollbars=1');return false;" PostBackUrl="~/ViewComment.aspx" Text="View Comment" Visible ="false"/>
<asp:Button ID="NotePost" runat="server" OnClick="NotePost_Click" Text="Post" Visible ="false"/> <br /><br />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Cs code
protected void NotePost_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
// Selects the text from the TextBox
// which is inside the GridView control
string textBoxText = ((TextBox)row.FindControl("Notestxtbox")).Text;
TextBox noteText = ((TextBox)row.FindControl("Notestxtbox"));
if (textBoxText != "")
{
string strConnectionString = ConfigurationManager.ConnectionStrings["SocialSystemConnectionString"].ConnectionString;
SqlConnection myConnect = new SqlConnection(strConnectionString);
SqlCommand cmd = new SqlCommand("INSERT INTO [Comment] (TypeId,Email,TextInput,UpdateID) VALUES (@TypeId,@Email,@TextInput,@UpdateID)", myConnect);
cmd.Parameters.Add("@TypeId", SqlDbType.VarChar);
cmd.Parameters["@TypeId"].Value = "Notes";
cmd.Parameters.Add("@Email", SqlDbType.VarChar);
cmd.Parameters["@Email"].Value = Emaillbl.Text; //Session
cmd.Parameters.Add("@TextInput", SqlDbType.VarChar);
cmd.Parameters["@TextInput"].Value = textBoxText;
cmd.Parameters.Add("@UpdateID", SqlDbType.VarChar);
cmd.Parameters["@UpdateID"].Value = UpdateIDlbl.Text; //Session
myConnect.Open();
cmd.ExecuteNonQuery();
myConnect.Close();
noteText.Text = "";
}
}
}
protected void Notebtn_Click(object sender, EventArgs e)
{
GridView1.Visible = true;
GridView2.Visible = false;
GridView3.Visible = false;
string strConString = ConfigurationManager.ConnectionStrings["SocialSystemConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(strConString);
SqlCommand cmd = new SqlCommand("SELECT TOP 5 Types.TypeID, [Update].TextInput, [Update].UpdateID, [User].FullName FROM Types INNER JOIN [Update] ON Types.TypeID = [Update].TypeId INNER JOIN [User] ON [Update].Email = [User].Email WHERE [Update].TypeId = 'Notes' ORDER BY [Update].UpdateTime DESC", con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
GridView1.DataSource = reader;
GridView1.DataBind();
reader.Close();
con.Close();
}
Learning
|
|
|
|
|
Julius88 wrote: Without capturing the UpdateID
You need to get this otherwise how do you expect to find the record to update.
There are number of things wrong here
1 you are asking an ASP ? in the C# forum
2 You have dumped in a large amount of useless code
3 Your code is open to SQL injection - always a bad idea.
Never underestimate the power of human stupidity
RAH
|
|
|
|