Jump to content
Xtreme .Net Talk

Joe Mamma

Avatar/Signature
  • Posts

    1093
  • Joined

  • Last visited

Everything posted by Joe Mamma

  1. diskspace is cheap compared to a hard to find bug. store them in char(13) - left pad with zeros. nothing worse that people storing SSN's in int fields.
  2. Do you need a client side activex control? or a server side COM control? I would like to see the exact assignment requirements. ActiveX usually implies user interface. This will be embeded and instance in the client browser via an <object> tag. you can't create a pure activex control with .Net. google "media player in web page" for an example of embedding activex.
  3. should have read: [font=Courier New][color=#0000ff]Dim[/color] Script [color=#0000ff]as[/color] [color=#0000ff]String[/color] = String.Format("var ctrl = document.getElementById(""{0}"");", Me.ThisControl.UniqueID)[/font][font=Verdana][/font]
  4. SQL Server Agent can schedule jobs for you
  5. when rendering the ID of a control, the rendered ID is simple Control.UniqueID. so to render a document.getElementById - Dim Script as String = String.Format("var ctrl = document.getElementById({0});", Me.ThisControl.UniqueID)
  6. First I would switch to the Jet 4.0 OleDb Provider but this should work for both: cmdAdd.CommandText = "INSERT INTO tblTest (" & _ "Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8) VALUES (" & _ "?, ?, ?, ?, ?, ?, ?, ?)" cmdAdd.Parameters.AddWithValue("Parm1", lvItem.Text) cmdAdd.Parameters.AddWithValue("Parm2", lvItem.SubItems(1).Text) cmdAdd.Parameters.AddWithValue("Parm3", CDate(lvItem.SubItems(2).Text)) cmdAdd.Parameters.AddWithValue("Parm4", lvitem.SubItems(3).Text) cmdAdd.Parameters.AddWithValue("Parm5", lvitem.SubItems(4).Text) cmdAdd.Parameters.AddWithValue("Parm6", lvitem.SubItems(5).Text) cmdAdd.Parameters.AddWithValue("Parm7", lvitem.SubItems(6).Text) cmdAdd.Parameters.AddWithValue("Parm8", lvitem.SubItems(7).Text) cmdAdd.ExecuteNonQuery()
  7. With intellisense and code completion, parameters are trivial. And as PD mentioned . . . I know exactly how much time it costs to code with parameters. I have no idea what a bug will cost, time - money - customers. Nip it in the bud!
  8. webBrowser1.Navigate("about:blank"); mshtml.IHTMLDocument2 currentDoc = (mshtml.IHTMLDocument2)webBrowser1.Document.DomDocument; mshtml.IHTMLElement bodydisp = currentDoc.createElement("body"); mshtml.HTMLDocument doc = (mshtml.HTMLDocument)currentDoc; doc.appendChild((mshtml.IHTMLDOMNode)bodydisp); mshtml.HTMLBody bdy = (mshtml.HTMLBody)bodydisp; bdy.leftMargin = "0pt"; bdy.topMargin = "0pt"; bdy.innerHTML = "<img top=\"0\" left=\"0\" src=\"http://www.obj-tec.com/hotchick.gif\" />";
  9. ok . . . create a C# windows application - ManagingControls. add new class file. . . call it ManagedControl.cs. put this code in ManagedControl.cs: namespace ManagingControls { public class ManagedControl { string _name; System.Windows.Forms.Control _control; public ManagedControl(string name, System.Windows.Forms.Control control) { _name = name; _control = control; } public string Name { get { return _name; } } public System.Windows.Forms.Control Control { get { return _control; } } } public class ManagedControlList: List<ManagedControl>{} public interface IManagedControlContainer { ManagedControlList ManagedControls { get; } } } add a new form FormManager.cs. drop a listbox, 2 textboxes, and a button on it and put this code in FormManager.cs: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace ManagingControls { public partial class FormManager : Form { public FormManager() { InitializeComponent(); } public FormManager(IManagedControlContainer _container): this() { listBox1.DataSource = _container.ManagedControls; listBox1.DisplayMember = "Name"; listBox1.ValueMember = "Control"; textBox1.DataBindings.Add("Text", listBox1.SelectedValue, "Text"); textBox2.DataBindings.Add("Text", listBox1.SelectedValue, "Left"); this.button1.Click += button1_Click; } private void button1_Click(object sender, EventArgs e) { this.Close(); } } } drop a textbox and a button on form1.cs (the main form of the app) and put this code in form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace ManagingControls { public partial class Form1 : Form, IManagedControlContainer { public Form1() { InitializeComponent(); button1.Click += button1_Click; } private void button1_Click(object sender, EventArgs e) { FormManager frm = new FormManager(this); frm.ShowDialog(); } ManagedControlList IManagedControlContainer.ManagedControls { get { ManagedControlList list = new ManagedControlList(); list.Add(new ManagedControl(textBox1.Name, textBox1)); return list; } } } } run the app .. . press the button on Form1. . .type some text into textbox1. type some numbers into textbox2. watch what happens.
  10. short of changing the modifiers on txtBox to public or internal in the designer (not recommended in most cases) , do the following in Form1.cs: public partial class Form1 : Form { public Form1() { InitializeComponent(); } public Form1(string initialValue): this(){ this.txtBox.Text = initialValue; } public string TextBoxText { get { return this.txtBox.Text;} set { this.txtBox.Text = value;} } } usage: Form1 frm = new Form1("foobar"); frm.Show(); Form1 frm2 = new Form1(); frm2.TextBoxText = "foobar2"; frm2.Show();
  11. the replace function is deactivated by security configuration for applications outside of access. this can be overroiden via a registry setting, but this might not be suitable. for apps that call to the jet REPLACE I use a combination of instr and mid. its a pain I know, but its the only way to do it without changing the registry. for a list of the 'safe' jet functions look here and an outline of the configuration: http://support.microsoft.com/default.aspx/kb/294698
  12. heres a thread outlining passing elements to a modal dialog in html. this is what you want the result of your asp rendering to accomplish: http://www.xtremedotnettalk.com/showthread.php?t=93870
  13. how are you opening popup.aspx? via window.ShowModalDialog ? your user control should register a script block for opening the window. use the UniqueID property of the text box in the script to pass the rendered input element to the opened document as one of the arguments of the window.ShowModalDialog method. The opened document wrties to it via the window.dialogArguments property using javascript. make sense???
  14. you are only seeing a single instance because you are using a single call and the call is happening in a single thread. it opens . . . it closes. only one session at a time is being created.
  15. Assumptions: column 0 is not needed. column 1 contains an anchor with the inner text being a unique value in the table ok. . . given you have a method like this that returns the html table markup you want to parse - [csharp]string getTableText() { // // Enter code here to get your twext for the html table. . . // of the form <table><tr><td>...</td></tr></table> }[/csharp] define this set of classes. . . [csharp]namespace HtmlTableParse { class ColumnValues: Dictionary<int,double?> { internal void Parse(int index, mshtml.HTMLTableCell cell) { double d; if (Double.TryParse(cell.innerText, out d)) this.Add(index, d); else this.Add(index, null); } } class RowColumns : Dictionary<string, ColumnValues> { public static RowColumns Parse(mshtml.HTMLTable table, int titleColumn) { RowColumns result = new RowColumns(); foreach (mshtml.HTMLTableRow row in table.rows) { mshtml.HTMLAnchorElement anchor = null; foreach(mshtml.HTMLTableCell cell in row.cells) if (cell.cellIndex != 0) if (cell.cellIndex==1) { anchor = cell.firstChild as mshtml.HTMLAnchorElement; result.Add(anchor.innerText, new ColumnValues()); } else result[anchor.innerText].Parse(cell.cellIndex-2, cell); } return result; } } }[/csharp] reference mshtml com library reference system.windows.forms instance a WebBrowser control. Navigate to "about:blank" build a body and insert your table text extract the table element object run through the HtmlTableParse.RowColumns.Parse method [csharp] // instance a WebBrowser control. using(System.Windows.Forms.WebBrowser webbrowser1 = new System.Windows.Forms.WebBrowser()) { // Navigate to "about:blank" webBrowser1.Navigate("about:blank"); mshtml.IHTMLDocument2 currentDoc = (mshtml.IHTMLDocument2) webBrowser1.Document.DomDocument; // build a body and insert your table text mshtml.IHTMLElement bodydisp = currentDoc.createElement("body"); mshtml.HTMLDocument doc = (mshtml.HTMLDocument) currentDoc; doc.appendChild((mshtml.IHTMLDOMNode) bodydisp); webBrowser1.Document.Body.InnerHtml = getTableText(); mshtml.HTMLBody body = (mshtml.HTMLBody)bodydisp; mshtml.IHTMLElementCollection elems = (mshtml.IHTMLElementCollection)body.all; // extract the table element object mshtml.HTMLTable table = (mshtml.HTMLTable) elems.item(0,0); // run through the HtmlTableParse.RowColumns.Parse method RowColumns output = RowColumns.Parse(table, 1); // Test foreach (string key in output.Keys) { Console.WriteLine("{0}:", key); foreach (int col in output[key].Keys) { string val = output[key][col] == null ? "<NULL>" : output[key][col].ToString(); Console.WriteLine("\tColumn {0}: {1}", col.ToString(), val.ToString()); } } }[/csharp] returns a dictionary keyed by the values in column 1 of the orginal table. the objects associated in the dictionary for the keys is a column value dictionary. the column value dictionary is keyed by column number with a nullable double value.
  16. oh yeah. . . I will assume that one column is the title column and every column after that will contain a number. . . if the number cannot be parsed, I will store double.MinValue in it. Assumes .Net 2.0
  17. I am going to assume that you have a way of getting the HTML for the table that contains the rows and that you know what row to start on. for example, you can parse the text and get the the following in a string variable and pass that to a function: <table> . . . row definitions </table> give me a moment
  18. which framework are you using?
  19. Is that when the object is linked? I dont think a file is relevent if the object is embedded. What you want is embedded objects.
  20. is there a way to tell from the bytes that it is OLE? I guess you can pad 78 bytes on any other insert.
  21. give me the weekend and I will scour the delphi source to see how they bind images in their dbimage control
  22. I dont know if .NET has an ActiveX container control. . . but I dont think the problem is .net. . . the problem is access. you need to not use the bound container to slurp in your file. you need to build an access interface to open the file, read the bytes to an array, and push the bytes into the field. if you already have an array of bytes in the sql server that is a valid image, notice how access doesnt display it correctly? it only can display the embedded OLE object it loaded. and by the way, it doesnt work using an adp either. . . I tried that. You are going to have to rewrite the access so the image isnt bound, but has a picture box on it. in your move events, grab the byte array from the recordset, and coax it into the unbound image. . . also give a method for opening a file and pushing the bytes into the recordest field (and into the unbound image at the same time) again. . . check out DBPix. for 99 bux, it might be the best way to go :( sorry
×
×
  • Create New...