Jump to content
  • Advertisement

kappa

Member
  • Content Count

    207
  • Joined

  • Last visited

Community Reputation

138 Neutral

About kappa

  • Rank
    Member
  1. Thank you, this seem to be what I am looking for.. [edit] nm.. the problem lied elsewere.. :D [Edited by - kappa on October 10, 2006 7:17:50 AM]
  2. I have a question that I haven't got an answer to, I need my program to be able to upload an image file. I was hoping that I could programatically use the ftp that is built into internet explorer so that I didn't have to write my own from scratch, I wrote a quick program to see if this could actually be done, but I couldn't get it to work. FileInfo fi = new FileInfo(openFileDialog.FileName); fi.MoveTo("ftp://xxxxxx:xxxxxx@xxxxxxxxxx.net/" + openFileDialog.FileName.Remove(0,3)); Is there a way to do this? or should I give up and start writing my own?
  3. Can anyone confirm or deny this? Or am I not doing this correctly? if( FormsAuthentication.Authenticate(txtUserName.Text, txtPassword.Text )) FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, true ); else { txtPassword.Text = ""; if( System.Convert.ToInt32(ViewState["Tries"]) > 1 ) Response.Redirect("Denied.htm"); else ViewState["Tries"] = System.Convert.ToInt32(ViewState["Tries"]) +1; }
  4. well, here is the first part of the code. XmlTextReader reader = new XmlTextReader(docURI); reader.XmlResolver = null; XPathDocument doc = new XPathDocument(reader); XPathNavigator docnav = doc.CreateNavigator(); XPathNodeIterator itr = docnav.Select("/controlset/control"); while (itr.MoveNext()) { if (itr.Current.GetAttribute("function", "").Trim() == "flap control") { return; } } this works, if I add a element called control with the attribute function that is equal flap control the debugger gets an hit on the return statement. so this seems to work. [edit] Never mind, I solved the problem. I had to redeclare the XmlReader when using it again. thank you. [Edited by - kappa on May 26, 2006 3:19:28 PM]
  5. kappa

    [.net] Key capture C#

    If you are using vs.Net all you have to do is go to the controls propperties select autopostback and set it to true, if not you can do it in the HTML code by adding OnTextChanged=[insert_function_name] to the control. In the c# code add something like... protected void insert_function_name(object sender, EventArgs e) { //do whatever } example: <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { } protected void btnOk_Click(object sender, EventArgs e) { } protected void btnPreview_Click(object sender, EventArgs e) { } protected void txtArtNr_TextChanged(object sender, EventArgs e) { txtArtNr.Text = "hej"; } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body style="background-color:#E9E9C2"> <form id="form1" runat="server"> <div> &nbsp; <asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 32px; position: absolute; top: 32px" Text="Compositör" Width="40px"></asp:Label> &nbsp; <asp:TextBox ID="txtTitle" runat="server" Style="z-index: 101; left: 120px; position: absolute; top: 112px"></asp:TextBox> &nbsp; <asp:Label ID="Label2" runat="server" Height="16px" Style="z-index: 102; left: 32px; position: absolute; top: 72px" Text="Bild" Width="40px"></asp:Label> &nbsp; <asp:Label ID="Label3" runat="server" Style="z-index: 103; left: 32px; position: absolute; top: 112px" Text="CD-Titel"></asp:Label> <asp:TextBox ID="txtComposer" runat="server" Style="z-index: 104; left: 120px; position: absolute; top: 32px"></asp:TextBox> <asp:TextBox ID="txtImage" runat="server" Style="z-index: 105; left: 120px; position: absolute; top: 72px"></asp:TextBox> <asp:Label ID="Label4" runat="server" Style="z-index: 106; left: 32px; position: absolute; top: 152px" Text="Art. Nummer"></asp:Label> <asp:TextBox ID="txtArtNr" runat="server" Style="z-index: 107; left: 120px; position: absolute; top: 152px" AutoPostBack="True" OnTextChanged="txtArtNr_TextChanged"></asp:TextBox> <asp:TextBox ID="txtPriceCode" runat="server" Style="z-index: 108; left: 120px; position: absolute; top: 192px"></asp:TextBox> <asp:Label ID="Label5" runat="server" Style="z-index: 109; left: 32px; position: absolute; top: 192px" Text="Pris kod"></asp:Label> <asp:Button ID="btnOk" runat="server" OnClick="btnOk_Click" Style="z-index: 110; left: 224px; position: absolute; top: 232px" Text="Ok" Width="48px" /> <asp:Button ID="btnPreview" runat="server" Style="z-index: 112; left: 72px; position: absolute; top: 232px" Text="Förhandsgranska" OnClick="btnPreview_Click" /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <table> <tr> <td rowspan="2" style="width: 76px"> <asp:Image ID="Image1" runat="server" Height="100px" Width="100px" /></td> <td> </td> </tr> <tr> <td style="width: 176px; height: 64px"> </td> </tr> </table> </div> </form> </body> </html>
  6. kappa

    [.net] Key capture C#

    Set autopostback to true and use the text changed event.
  7. I got a very simple cfml file I'd like to write to, it looks like this: <?xml version='1.0'?> <!DOCTYPE controlset SYSTEM "cfml.dtd"> <controlset version="1.1.0" language="english" keyboard="us"> </controlset> I have been able to iterate through elements in this file using XPath. However, I now wish to write to it and I found something I can't seem to figure out by myself. I am trying to open the file with an XmlDocument, the file opens propperly (as in that it does not generate an exception. But instead of setting the root variable to controlset (XmlNode root = xmlDoc.DocumentElement;), it's set null and the program crashes on with an error saying that the object is not set to a reference on this line: root.AppendChild(control); //....Snippet removed....// XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load(reader); } catch { MessageBox.Show("Couldn't load air.cfml"); } reader.Close(); XmlNode root = xmlDoc.DocumentElement; XmlElement control = xmlDoc.CreateElement("control"); XmlElement key = xmlDoc.CreateElement("key"); root.AppendChild(control); //....Snippet removed.....// Can anyone tell me what I am doing wrong?
  8. I wrote a dll in C# looking like this: public void Start() { m_tkWriter = new Toolkit(); m_tkWriter.OpenOutputFile( "c://test_pdf//test.pdf" ); } public void End() { m_tkWriter.CloseOutputFile(); m_tkWriter = null; } public void PrintTextBlock( string font, float fontsize, float length, float width, string text, short justification ) { y_current -= m_tkWriter.HeightPrinted; m_tkWriter.PrintMultilineText( font, fontsize, (x_current+LeftMargin), y_current-fontsize, A4X-(RightMargin+LeftMargin), (A4Y-(TopMargin+BottomMargin)), text, justification ); while( m_tkWriter.ClipText != "" ) { y_current = A4Y; m_tkWriter.NewPage(); m_tkWriter.PrintMultilineText( font, fontsize, (x_current+LeftMargin), (y_current-TopMargin)-(fontsize), A4X-(RightMargin+LeftMargin), (A4Y-(TopMargin)), m_tkWriter.ClipText, justification ); if( m_tkWriter.ClipText == "" ) y_current -= TopMargin; } } and I am using it (or should be using it) in a regular asp website, like this: PDF.Start PDF.PrintTextBlock CStr(vcharFontNameText), CDbl(intFontSizeText), 500.0, 500.0, CStr(vcharQuestion2), 0 PDF.End PDF.Start runs ok, so it can't be that it does not find the dll, but the PrintTextBlock function gives me an error that reads roughly translated to invalid procedure or method. Where am I doing wrong?
  9. I am doing a small administration site and I needed a place for the administrator to login. Instead of doing two different pages I though it would be a good idea to just show/hide the part of the website that I do not wish to be displayed. This seem to work fine at first glance except that vs2003 unsubscribe all the eventhandlers that exists for controlls in my labels, this was easily solved as all I had to do was manually rewrite them. However I have a OnIndexChanged event on a dropdownbox that just fail, and I cannot get it to execute. Is this a bad idea? or has it something to do with vs/my code, because I am fairly sure I have done this before. Is there a better way to do this? Here is the by VS destroyed Html <%@ Page language="c#" Codebehind="Admin.aspx.cs" AutoEventWireup="false" Inherits="Subscription.Admin" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>Admin</title> <meta content="Microsoft Visual Studio .NET 7.1" name=GENERATOR> <meta content=C# name=CODE_LANGUAGE> <meta content=JavaScript name=vs_defaultClientScript> <meta content=http://schemas.microsoft.com/intellisense/ie5 name=vs_targetSchema><LINK href="SubscriberStylesheet.css" type=text/css rel=stylesheet > </HEAD> <body MS_POSITIONING="GridLayout"> <form id=Form1 method=post runat="server"> <asp:Label ID="lblAdminLogin" Runat="server"> <table cellSpacing="0" cellPadding="0" width="500" border="0"> <tr> <td vAlign="top"> <table cellSpacing="0" cellPadding="0" width="495"> <tr> <td vAlign="top" width="20" bgColor="#006666"></td> <td vAlign="top" width="65" bgColor="#ffffff"> <span class="rubbe">Administration</span> </td> <td vAlign="top" width="400" bgColor="#006666"></td> </tr> </table> </td> </tr> <tr> <td bgColor="#ffffff" height="5"></td> </tr> <tr> <td vAlign="top"> <table borderColor="#006666" cellSpacing="0" cellPadding="2" width="495" border="1"> <tr> <td class="text01" vAlign="top"> <table cellSpacing="0" cellPadding="2" border="0"> <tr> <td class="text01" width="35">Användarnamn: </td> <td><asp:textbox id="txtUsername" runat="server" Width="184px"></asp:textbox></td> </tr> <tr> <td class="text01" width="35">Lösenord: </td> <td><asp:textbox id="txtPassword" runat="server" Width="184px" TextMode="Password"></asp:textbox></td> </tr> </table> </td> <tr> <td vAlign="top" align="right"><br> <asp:button id="btnLogin" runat="server" Width="110px" Text=" Logga in »"></asp:button> <br> </td> </tr> </table></td></tr></table> </asp:Label> <asp:Label ID="lblAdminMail" Runat="server" Visible="False"> <table style="WIDTH: 544px; HEIGHT: 481px" cellSpacing="0" cellPadding="0" width="544" border="0"> <tr> <td vAlign="top"> <table width="550" cellpadding="0" cellspacing="0"> <tr> <td width="20" valign="top" bgcolor="#006666"></td> <td width="400" valign="top" bgcolor="#ffffff"> <span class="rubbe">Skicka meddelande till prenumeranter</span> </td> <td width="400" valign="top" bgcolor="#006666"></td> </tr> </table> </td> </tr> <tr> <td bgColor="#ffffff" height="5"></td> </tr> <tr> <td vAlign="top"> <table borderColor="#006666" cellSpacing="0" cellPadding="2" width="550" border="1"> <tr> <td class="text02" vAlign="top"> <table style="WIDTH: 520px; HEIGHT: 310px" cellSpacing="0" cellPadding="2" border="0"> <tr> <td vAlign="top"><span class="text02">Ange meddelanderubrik:</span></td> </tr> <tr> <td><asp:TextBox runat="server" Width="536px" ID="txtMailSubject"></asp:TextBox> </td> <tr> <td vAlign="top"><span class="text02"><br> Ange meddelandetext:</span></td> </tr> <tr valign="top"> <td style="HEIGHT: 190px"><asp:TextBox runat="server" Height="178px" TextMode="MultiLine" Width="536px" ID="txtMailBody"></asp:TextBox> </td> </tr> <tr valign="bottom"> <td valign="bottom" style="HEIGHT: 28px"><span class="text02">Sidfot: </span></td> </tr> <tr valign="top"> <td style="HEIGHT: 96px"><asp:TextBox runat="server" Height="90px" TextMode="MultiLine" Width="536px" ID="txtMailFooter"></asp:TextBox> </td> </tr> <tr> <td vAlign="top"><span class="text02">Välj prenumerationsgrupp: <br><asp:DropDownList runat="server" Width="88px" AutoPostBack="True" ID="prenGroups"></asp:DropDownList> </span><asp:LinkButton runat="server" ID="showMembers">Visa medlemmar i vald prenumerationsgrupp</asp:LinkButton> </td> <td vAlign="top"><span class="text02"><br> </span> </td> </tr> </table> </td> <tr> <td vAlign="top" align="right"><br> <asp:Button runat="server" ID="btnClear" Text="Rensa"></asp:Button> <asp:Button runat="server" ID="btnSend" Text=" Skicka » "></asp:Button> <br> </td> </tr> </table> </td> </tr> </table> </asp:Label> <table border=0> <tr> <td style="BORDER-RIGHT: #006666 2px solid; BORDER-TOP: #006666 2px solid; BORDER-LEFT: #006666 2px solid; BORDER-BOTTOM: #006666 2px solid" ><asp:datagrid id=gridSubscribers runat="server" Width="544px" AutoGenerateColumns="false" AlternatingItemStyle-Wrap="False" BorderStyle="None" BackColor="#E0E0E0" BorderWidth="0px"> <FooterStyle BorderStyle="None"></FooterStyle> <EditItemStyle BorderStyle="None"></EditItemStyle> <AlternatingItemStyle Wrap="False" BackColor="White"></AlternatingItemStyle> <ItemStyle BorderStyle="None"></ItemStyle> <HeaderStyle Font-Bold="True" BorderStyle="None" BackColor="White"></HeaderStyle> <Columns> <asp:BoundColumn DataField="SubscriberName" HeaderText="Namn"> <ItemStyle Width="50%"></ItemStyle> </asp:BoundColumn> <asp:BoundColumn DataField="SubscriberMail" HeaderText="E-post adress"></asp:BoundColumn> </Columns> <PagerStyle BorderStyle="None"></PagerStyle> </asp:datagrid></td></tr></table></TD></TR></TBODY></TABLE></form> </body> </HTML> If anyone against all probbability feels like it would be a swell time to look at it.
  10. Thank you! I knew there were something fundamental that I had missed.
  11. CREATE proc AddSubscriber @name text, @mail varchar(999), @group int as declare @key uniqueidentifier; set @key = NEWID(); INSERT INTO tblSubscribers (SubscriberName, SubscriberMailadress, FKSubscribeGroup, SubscriptionConfirmationKey) VALUES( @name, @mail, @group, @key )
  12. I just ported a ADO data access layer to ODBC and now I am having problems, I get this error when I try to start it... Procedure "AddSubscriber" expects parameter "@name", which was not supplied public static void AddSubscriber( Subscriber subscriber, IDBManager dbManager) { IDbCommand command = dbManager.CreateCommand("AddSubscriber", CommandType.StoredProcedure); command.Parameters.Add(dbManager.CreateParameter("@name",subscriber.SubscriberName,OdbcType.Text,ParameterDirection.Input)); command.Parameters.Add(dbManager.CreateParameter("@mail",subscriber.SubscriberMail,OdbcType.Text,ParameterDirection.Input)); command.Parameters.Add(dbManager.CreateParameter("@group",subscriber.SubscriberGroup,OdbcType.Text,ParameterDirection.Input)); dbManager.ExecuteNonQuery(command); //subscriber.ConfirmationKey = (string)((IDataParameter)command.Parameters["@key"]).Value; } public interface IDBManager { OdbcDataReader ExecuteReader(IDbCommand command); IDbCommand CreateCommand(string commandText, CommandType commandType); IDbDataParameter CreateParameter(string parameterName, object parameterValue, OdbcType parameterDBType, ParameterDirection parameterDirection ); int ExecuteNonQuery(IDbCommand command); } namespace Odbc { public class OdbcDBManager : IDBManager { private OdbcConnection odbcConnection; public OdbcDBManager(string connectionString) { try { odbcConnection = new OdbcConnection(connectionString); } finally { if( odbcConnection.State == ConnectionState.Open ) { odbcConnection.Close(); } } } #region IDBManager Members public OdbcDataReader ExecuteReader(IDbCommand command) { OdbcCommand odbcCommand = (OdbcCommand)command; odbcCommand.Connection = odbcConnection; odbcCommand.Connection.Open(); OdbcDataReader reader = odbcCommand.ExecuteReader(CommandBehavior.CloseConnection); if( reader.HasRows ) { return reader; } else { reader.Close(); return null; } } public IDbCommand CreateCommand(string commandText, CommandType commandType) { OdbcCommand tmpOdbcCommand = new OdbcCommand(commandText); tmpOdbcCommand.CommandType = commandType; return tmpOdbcCommand; } public IDbDataParameter CreateParameter(string parameterName, object parameterValue, OdbcType parameterDBType, ParameterDirection parameterDirection) { OdbcParameter tmpOdbcParameter = new OdbcParameter(); tmpOdbcParameter.ParameterName = parameterName; tmpOdbcParameter.Value = parameterValue; tmpOdbcParameter.OdbcType = parameterDBType; tmpOdbcParameter.Direction = parameterDirection; return tmpOdbcParameter; } public int ExecuteNonQuery(IDbCommand command) { OdbcCommand odbcCommand = (OdbcCommand)command; try { odbcCommand.Connection = odbcConnection; odbcCommand.Connection.Open(); return odbcCommand.ExecuteNonQuery(); } finally { if( odbcCommand.Connection.State == ConnectionState.Open ) { odbcCommand.Connection.Close(); } } } #endregion } } What am I missing?
  13. I have nothing in my page load function.
  14. I am programming for a mod that will eventually be sold through steam, so depending on what deal you get with the developers it's very legal (or illigal). This of course prevents us from using any of valves work such as graphics.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!