Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
S

Shawn_H

@Shawn_H
About
Posts
14
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Delete Temp File after N seconds
    S Shawn_H

    Im using ASP.net 2.0. I have a need to temporarily save an image to disk, and then want it automatically deleted within a minute. Im a gernating dynamic pdfs, with dynamic charts embeded in the PDF. The charts need to be temporarily saved as an image on disk with Guid.NewGuid().ToString() + ".jpg"; for example as the file name. I thought about using the Web.Cache with a Delegate CacheItemRemoveCallBack setting abosulte expiration to expire in 60 seconds, then when the listener is fired, delete the file. Problem is, that method will not work. because the file has a unique key in cache (using the file name as the cache key which is from NewGuid) , it will never be fired beacause that cache key will never be fired again. the same image will never be generated twice. For time-based dependencies, the callback is not fired when the time is up, but rather the next time the cached item is accessed. So cant depend on these to act as a timer for me to remove an item in N seconds. I would rather not get into the business of schedule task manager to run and delete files etc... I suppose that in this handler (btw, its in an httpHandler) I could just do a check on time stamps and remove files older than N secs, I would rather not slow the request down though. For some reason, im thinking Threading namspace / Timer object (maybe overboard). Does anyone have any suggestions? let me know if you need more info. Thank You all greatly in advance Shawn

    ASP.NET csharp asp-net business help tutorial

  • Multi Threading in WinForms
    S Shawn_H

    Excellent.... once again...I was overthinking. Thanks

    C# csharp winforms com help tutorial

  • Multi Threading in WinForms
    S Shawn_H

    Greetings, I'm in .NET 2.0 I'm working on an app where the Main Form contains a webBrowser Control. I do not want to show the Main Form until the document has completed loading in the web browser control or until 60 seconds has passed...in which case, I will then load an offline version. The webBrowser control has a DocumentCompleted event. So that I know if it has finished loading. The problem is, I need to Load the url for the webBrowser control on a separate thread, and then loop for 60 seconds on the GUI Thread, or Until Ive been notified that the document has loaded. I have tried something like this....but I think the problem is that the webBrowser Control belongs to the GUI Thread.

    //Constructor
    public frmMain()
    {
    ThreadStart ts = new ThreadStart(DoWork);
    Thread thread = new Thread(ts);
    thread.Start();

    //Give one minute to find the site

    for (int i = 0;i<60;i++)
    { if (m_documentLoaded)
    {
    i = 60;
    }
    else
    {
    System.Threading.Thread.Sleep(1000);
    }
    }
    }

    public void DoWork()
    {
    //Fill the URL
    System.Uri url = new System.Uri("http://myDomain.com/default.aspx/");
    webBrowser1.Url = url;
    }

    //Event for webBrowser Control...fires when document completes loading
    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
    //now show the form if it is hidden.
    m_documentLoaded = true;

    }

    I know what I want to Do...just not sure exactly how to carry it out... Thanks for any input

    C# csharp winforms com help tutorial

  • use a string by reference?
    S Shawn_H

    Black Dice, You can create a sql Server function that takes a delimited list as a parameter and returns a table. then in your select list you join onto this function SELECT firstname, lastname FROM employee e INNER JOIN fn_MyFUnction(@DelimitedList) f On e.ID = F.ID "Never Code by Coincidence" -- Andy Hunt

    Database database com tools question

  • Which Control To use?
    S Shawn_H

    I am working on a tool for Data Services, and decided to create the tool as a VB.NET windows application. I am not a VB .Net developer, but know enought to get by, though I struggle with the controls because I've never used them (I have used VB 6 controls). The purpose of the App is to Update an online questionnaire, the questionnaire has branching...etc. So far, I open a form that Loads two drop down boxes. 1st drop down loads companies, second drop drown is bound to questionnaires for the company selected. You then select the questionnaire being updated. Then I use Common Dialog, open file, to select an Excel spread sheet that has the new questionnaire stucture, with new questions. You then click on "Update" and the excel spreadsheet is loaded into a datatable, and the existing "Active" questionnaire is pulled from the DB into another datatable. I then do a row by row comparison against the spreadsheet and the existing version comparing things like question text, answer label, incorrectness of question....among other things, in order to determine if there are new questions being submitted, other wise, I want to use the existing question. some of these take human interaction in order to determine if the question is new. Although I scrub the excel data down, there are still things you cant possible take into account. So after doing all my comparisons, in instead of popping up a message box every time somethiing is different (there are hunderds of rows and this woudl be annoying) I would like to mark (flag) differences and then when comparison is complete, open up a new form with a with a check box by each possible new question, so the user can validate, by going through and checking what IS actually new. What control should I use? A listview? I want a checkbox on the left. I would also like to change the background color of the part that has actually changed. Say for instance, the question text changed, or the Answer text changed, of if the incorrectness changed, then mark that. Thanks in advance for time in effort in this matter. Also, any good resources on the recommended control would be gread. Shawn

    Visual Basic question announcement csharp database

  • T-SQL Problem
    S Shawn_H

    if they are scalar values you are dealing with then just do this. declare @a int, @b int, @c int, @d int select @a = 1, @b= 2 select @c = 3, @d= 4 select @a as ColA, @b as ColB, @c as ColC, @d as ColD Else, if it is a rowset, then do what alam_pune said, but pull a join column from each of the sub selects in order to join the rowsets to avoid the cartesian product select Select1.A, Select1.B, Select2.C, Select2.D from (select A, B, PriKeyCol from Table1) as Select1 inner join (select C, D, ForKeyCol from Table2) as Select2 on select1.PriKeyCol = select2.ForKeyCol

    Database sharepoint database help question

  • How to pass QueryString values in Asp:HyperlinkColumn
    S Shawn_H

    So you mean creating an additional field in the original dataset like I did in my example, but then Binding it in the aspx page like you showed in your example, but just binding to the one field (The one you create by making the whole query string)? I hope that made sense Shawn

    ASP.NET tutorial question

  • How to pass QueryString values in Asp:HyperlinkColumn
    S Shawn_H

    Ahhh Yes minhpc, I knew if I stuck my neck out there you would reveal a better way....thanks! Shawn

    ASP.NET tutorial question

  • How to pass QueryString values in Asp:HyperlinkColumn
    S Shawn_H

    Disclaimer, Im only a newbie, and there is probably a better way..with that said I do something similar, but I handle it through the ItemDataBound Event. However when I first Bind my datagrid to my dataset, I create a new column for Href and for each record in the in the result set, I create the associated query string with the proper ID's. The below line is located in my BindGrid Function For Each categoryRow In DepartmentRow.GetChildRows(dr) aNewRow = Ds.Tables("Menu").NewRow aNewRow.Item(0) = DepartmentRow.Item(0) aNewRow.Item(1) = categoryRow.Item(1) aNewRow.Item(2) = "?DID=" & DepartmentRow.Item(0).ToString & "&CID=" & categoryRow.Item(1).ToString aNewRow.Item(3) = "   " & categoryRow.Item(2).ToString 'Add the cat row to the main datatable Ds.Tables("Menu").Rows.Add(aNewRow) Next categoryRow DataGrid1.DataSource = Ds.Tables(0).DefaultView DataGrid1.DataBind() DataGrid1.Columns(0).Visible = True DataGrid1.Columns(1).Visible = False DataGrid1.Columns(2).Visible = False DataGrid1.Columns(3).Visible = True This Href column is a hidden column in my datagrid, then in the ItemDataBound event,I can access this QueryString for each record like this and assign it to the LinkButton's NavigateUrl Property: Protected Sub DataGrid1_ItemBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs) Handles DataGrid1.ItemDataBound If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then Dim qryString As String = CType(e.Item.DataItem, DataRowView)(2).ToString CType(e.Item.FindControl("linkname"), HyperLink).NavigateUrl = PathPrefix() & qryString CType(e.Item.FindControl("mnuCell"), HtmlTableCell).Attributes.Add("onClick", "document.location.href='" & PathPrefix() & qryString & "'") End If End Sub Remember the Column indexed 2 (the third colum) in my datagrid is hidden, but this way I have it there on the first binding, and on all postbacks. Hope this helps

    ASP.NET tutorial question

  • How to invoke onbubbleevent in datagrid
    S Shawn_H

    minhpc, Im fairly new to .NET, comming from stale old Classic ASP and Coldfusion, but I was reading your response in this thread, and just wanted clarification for myself on this '********************************* Another way is that you don't need to bubble up the event, you simply create an event handler for the SelectedIndexChanged event of the dropdownlist, and provide your logic in the handler '********************************* So if I have a dropdownListBox decared in my code behind withevents, and use the AddHandler for SelectedIndexChanged event and link it to my own custom function, will it still raise this event and call my custom function even though this control is burried in an ItemTemplate inside a datagrid? Thanks....Im learning here PS..thanks for the help in the other thread

    ASP.NET help tutorial question

  • SQL Script Generation
    S Shawn_H

    Hai IT should add them if you go to options tab, the check the box for SCript Primary Keys, foreighn Keys, defaults, and check constraints....If you did in fact set the default when you created your table. If you didnt already create your table then you do it through code by hand like this You would Use the DEFAULT Keyword like this in your create statement....this gives the Column named MyName a default value of 'Im Nameless' CREATE TABLE dbo.TempTable ( Tempid INT NOT NULL PRIMARY KEY, MyName VARCHAR(30) NOT NULL DEFAULT 'Im Nameless' ) And Maybe, in case I didnt read your question right, if you are saying because you already have created the default values and you are not getting these Default constraints in the output script, then you could always go into the create script and add an ALTER statement ALTER TABLE dbo.TempTable ADD CONSTRAINT def_My_Name DEFAULT 'Im Nameless' FOR MyName Dont know if this is what you are looking for or not

    ASP.NET database tools sql-server sysadmin

  • ItemCommand Not Firing with ImageButton
    S Shawn_H

    minhpc, Yeah, That spelling error was not in the original code, but was done after I posted it into the code project form (as I was trying to format in order to make it more readable.) I did have break points set though, with all the code commented out of the event except for a simple If 1=1 Then Dim str As string = "Hello" and it never fired..... I dont know what it was, it was something weird though...no big deal, thanks for looking at it though Shawn

    ASP.NET question html design

  • Help with .Attributes[&quot;onclick&quot;]=...
    S Shawn_H

    try throwing up this right before the if statement and check to see what the value of pbutton.style.visibility really is...maybe its not equal to "visible" as you are expecting alert(document.getElementById("pButton").style.visibility ); Shawn

    ASP.NET help javascript sysadmin question

  • ItemCommand Not Firing with ImageButton
    S Shawn_H

    minhpc, Yes, I did set a break point and ran the app in debug mode. The ItemCommand Event never fired when the ImageButton was in the column, But then when I changed it to a LinkButton, it fired. Im fairly new to ASP.NET, so I was just wondering why the LinkButton fired this event, but not the ImageButton. I put both versions of code in the starter thread, could you see why the ImageButton wouldnt fire? Thanks Shawn

    ASP.NET question html design
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups