Solved
Casper Hansen
Posts
-
RequiredFieldValidator price range -
RequiredFieldValidator price rangeHello all I have 2 textboxes on my aspx site which I want to validate. I want to make sure that the second textbox value is higher than the first one. For example: The user inputs 40 in the first textbox and 20 in the second. This will give an error since 20 is less than 40. But if the user types 40 and 60 it should work. It should also be numbers only :) Any ideas? Cheers! :-D
-
"Out of memory exception when loading image with bitmapThe value on localhost is: D:\Skole\DotNet\Portfolio\Portfolio\images\portfolio\stor_cronaldoHjemmeside.jpg And on the webhost it is: d:\web\localuser\dumpen.dk\public_html\images\portfolio\stor_cronaldoHjemmeside.jpg It works with 2 or 3 images but with more then that the error occours
-
"Out of memory exception when loading image with bitmapThe "new bitmap" needs a full path an images/something/blah.jpg doesnt work. I am using Server.MapPath to find the full path
-
"Out of memory exception when loading image with bitmapHello all I have a mysql table with some rows in it that contain a path to a jpg file. Here is a example of the path: images/portfolio/lille_ilveaWebshop.jpg The file excists on the webhost so that is not a problem. I am loading the jpg file into a bitmap in a foreach. It works fine when I am on a local server, but when I upload it to my webhost it says: <quote>Server Error in '/' Application. Out of memory. Exception Details: System.OutOfMemoryException: Out of memory. [OutOfMemoryException: Out of memory.] System.Drawing.Bitmap..ctor(String filename) +376480 Referencer.Page_Load(Object sender, EventArgs e) +561 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627</quote> I cant seem to figure out just why it would do that. Here is the code I am using: foreach ( DataRow Row in objPortFac.VisReference(refKatID).Rows) { // Create a new bitmap with the path from the row // fldStortBillede is the field that contains the path Bitmap objStortBillede = new Bitmap(Server.MapPath(Row["fldStortBillede"].ToString())); // Dispose the bitmap after use objStortBillede.Dispose(); } Any suggestions?
-
Store neutral date in databaseWhat do you mean?
-
Store neutral date in databaseHello all I am building a website and I want to store the current time in a database, thats not a problem. But I also want to make the time format changable. For example if I have "May 2 2009" stored in the database and I decide I want to change the format to "5/2/2009", I need to either update the database or use a neutral date format that can be converted to the date format I want. Any tips on this? I thought about using timestamp, but cant rellay see where it fits in Thanks
-
File.Move throws exceptionIm using jQuery ajax method to call the webservice $.ajax({ type: "POST", url: "fileManager/WebService.asmx/EditFile", contentType: "application/json; charset=utf-8", dataType: "json", data: "{'FilePath':'" + filePath + "', 'NewName':'" + newName.val() + "', 'OldName':'" + oldName.text() + "'}", }); The file is used in a tag No where else, hope you understand. It only works the first time I try it, the next it throws an error
-
File.Move throws exceptionHello all I am using WebMethod and File.Move But my problem is the file is being locked by the WebMethod and it cannot be moved again (I want to rename it, not move it) The exception thrown is "The process cannot access the file because it is being used by a another process" How do I solve this? I probably googled for half an hour Here is my code:
\[WebMethod\] public void EditFile(string FilePath, string NewName, string OldName) { File.Move(FilePath + OldName, FilePath + NewName); }
-
Retriving data from a irc serverIs this the correct way of using thread?
using System;
using System.Windows.Forms;namespace mutlithread
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}// Event handler void FakeUIUpdater(string textboxText) { // Create a new delegate updater UIUpdaterDelegate updateUI = new UIUpdaterDelegate(UpdateUI); // Send the delegate to the winform this.Invoke(updateUI, new object\[\] { textboxText }); } // Create the delegate delegate void UIUpdaterDelegate(string textboxText); // Update the user interface with the arguments set earlier in fakeuiupdater protected void UpdateUI(string textboxText) { textBox1.Text = textboxText; } private void button1\_Click(object sender, EventArgs e) { FakeUIUpdater("test"); } }
}
-
Retriving data from a irc serverI would like help with the logic as well or just some other soloution for my problem
-
Retriving data from a irc serverWell no :P Thats why I ask here since I cant seem to come up with a solution
-
Retriving data from a irc serverHello. I have been creating a simple irc client that connects to a server and sends some simple commands to it I have also figured out how to retrive data from the server by using streams The problem is I have to run a never-ending while to keep retriving all the data from the server I do it like this:
while ((inputLine = reader.ReadLine()) == null) { listBox1.Items.Add(reader.ReadLine()); }
The problem is that my form doesent respond (I cant use buttons, and such) since the while is never-ending Is there any way of adding a event that triggers when there is new data from the server? Here is my project: dumpen.dk/include/files/IrcBot.rar And a bonus question: When connecting to Quakenet and joining a channel it says: 451 Register first Why is that?
-
Dragable rectanglesHey I have this project now: http://peecee.dk/upload/download/123403 It allmost works, the preview thing just doesnt work properly Could you guys take a look at it? Because I cant seem to find a soloution
-
Dragable rectanglesHello. I have a question.. I have this script:
int mouseDownX;
int mouseDownY;int width; int height; private void Form1\_MouseUp(object sender, MouseEventArgs mouseEv) { width = mouseEv.X - mouseDownX; height = mouseEv.Y - mouseDownY; textBox2.Text = Convert.ToString(mouseEv.Location); Graphics graphics = this.CreateGraphics(); Rectangle rectangle = new Rectangle( mouseDownX, mouseDownY, width, height); graphics.DrawRectangle(Pens.Red, rectangle); } private void Form1\_MouseDown(object sender, MouseEventArgs mouseEv) { textBox1.Text = Convert.ToString(mouseEv.Location); mouseDownX = mouseEv.X; mouseDownY = mouseEv.Y; }
Which works fine if I make a rectangle from the left top corner to the right bottom corner But is there any easier way of just making rectangles? Here is a video of what I want: http://www.youtube.com/watch?v=V5YO4U1UnO0 And here is a download link to my project: http://peecee.dk/upload/download/123329 So I want to be able to draw rectangles from any angle if you understand?
-
StreamWriter & xml reading problemHello. I have this wierd problem when im writing to a text file with data from a array I have this method:
private void writeData() { // Open file StreamWriter writeData = new StreamWriter(saveMonsterSetBase.FileName, false); // Write all data from array to file for (int x = 0; x < MonsterSetBaseDataArray.Count; x++) { writeData.WriteLine(MonsterSetBaseDataArray\[x\]); } // Close stream writeData.Close(); }
Which is trigged here:
saveMonsterSetBase.ShowDialog(); if (saveMonsterSetBase.FileName != "") { writeData(); }
It works fine and opens my saveFileDialog But after I save it I get a "file not found" on some other method I use This is some of the method:
// Opening txt file with location from XML StreamReader findMonsterStream = new StreamReader(@XMLmonsterLocation);
I get the error monster.txt (XMLmonsterLocation) is not found It looks like the writedata changes the local path because it says File not found in the path where I saved the file Example: The application and monster.txt (XMLmonsterLocation) is saved in D:\ I then use the saveFileDialog (I save a file to for example C:\) and when I access my method where I use the XMLmonsterLocation it says file not found in C:\ So I dont know why Hope you understand The StreamReader reads from a xml file that looks like this:
monster.txt
MonsterSetBase.txt
mobs\
maps\
maps\maps.txt -
Auto update of program (Downloading from web)Thank you Im glad you like the idea But do you have any like real code for me? Because (for me since im not that expierenced) its hard to go from idea to actullay coding it A snippet or similar is just fine! :)
-
Auto update of program (Downloading from web)Hello. I have been creating a application that checks the application version and sees if it fits with the version from http://msbeditor.dumpen.dk/versioninfo.html If it doesnt I use a webBrowser component to open a download link to http://msbeditor.dumpen.dk/msbEditor.rar But this is not very practical because, the ones using my application have to download all files even though some of the files are not changed.. So I wanted to ask if you have an idea on how to make a auto updater in C#? I was thinking of something like: Check the application version with the online version (Allready done) If it doesnt fit, then match all the files (last changed or file size or similar) in the rar file (from msbeditor.dumpen.dk) with the files in the application folder If they are changed then download the changed files Any ideas?
-
Enable/disable buttons according to txt file// Current lines left in the array // Adding + 1 so it wont take the current line linesLeft = currentLineNumber + 1; // Looping through the rest of the lines from my array.Count for (int i = linesLeft; i < MonsterSetBaseDataArray.Count; i++) { // Check if the line is valid // CheckIf will return true or false (bool) checkIf(Convert.ToString(MonsterSetBaseDataArray\[i\])); // If the data is valid if (checkIfStatus == true) { // Stop the for break; } }
Here is what I got so far on my next / forward button I thought of doing it like this: If one of the remaining lines in the array is valid, the button will not be disabled, but if there is no valid lines left the button will be disabled. I just couldn figure out the last part Any ideas on this? I know how to disable the button, but I dont know when to do it. I disable my button like this: nxtButton.Enabled = false; Hope you can help, because im beginning to get desperate..
-
Enable/disable buttons according to txt fileYeah I know how to do that, but the problem is that there can be some unvalid data and I dont know how to enable/disable if the data is unvalid The text file is not the same all the time. The user can change it So it could look like this:
// Comment
2
0 0 20 177 185 4 // (If any)
0 0 20 75 65 4 // (If any)
0 0 20 85 65 4 // (If any)
0 0 20 95 65 4 // (If any)
0 0 20 15 65 4 // (If any)
0 0 20 55 65 4 // (If any)
0 0 20 91 65 4 // (If any)
endOr this:
// Comment
2
0 0 20 177 185 4 // (If any)
0 0 20 75 65 4 // (If any)
0 0 20 85 65 4 // (If any)
0 0 20 95 65 4 // (If any)
0 0 20 15 65 4 // (If any)
0 0 20 55 65 4 // (If any)
0 0 20 91 65 4 // (If any)
end
// End of this
// ShitOr
2
0 0 20 91 65 4 // (If any)
end
// No this is the endIf we take the last example the only valid data is 0 0 20 91 65 4 // (If any), so I want to disable the forward and previous button since there is no valid data to go to I thought of an example where I looped the whole array and searched for a valid data, but couldn seem to figure it out Here is how I read my text file:
while ((MonsterSetBaseLine = rds.ReadLine()) != null) { // If not then add normal MonsterSetBaseDataArray.Add(MonsterSetBaseLine); } }
You might want to see this video: http://youtube.com/watch?v=yLMDBRms-KU You can see there are two buttons (forward and previous) where I go through the text file So if the data is unvalid I skip it and go to the next valid data Now if there is no valid data left in the text file I want to disable the forward button Hope you understand my long post