|
Hey everyone!
I want to create a dialog window (SDI...) that will connect to the net to a certain address I'm writing inside my code. (so no one can change the address, only browse from the page they're getting).
Thanks!!!
|
|
|
|
|
I take it there is a question in this post somewhere? What exactly are you having a problem with?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
the thing is that I want to open the dialog window and it will directly connect me to a specific address (like http://www.codeproject.com).
I don't have any specific question because I don't know exactly how to approch this problem.
I looked in the board for an answer, for any kind of code that might help me with this, but I couldn't really find one.
|
|
|
|
|
All you need to do is drop a web browser control on the form and use it's Navigate method with the address you want.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks!
I already have done that (after my last post), and I wrote another post about it.
the thing is that everything works fine as long as I don't use the Navigate method (and thats kinda useless), but when I'm tryint to use the Navigate method I'm getting: "InvalidActiveXStateException" exception.
I really don't understand why, I checked the web for an answer but I didn't find anything that really works.
now I'm lost !
|
|
|
|
|
okay, solved it!
thanks!!!
and just for all of you out there who encounters the same problem,
the Navigate method has to occure only AFTER the form has been completly loaded, thats why we cannot use it in the constractor.
to make the Home page start downloading right after you open the window just use the Navigate method in the FrmMain_Load event function ("Load" event of the form).
|
|
|
|
|
hi all,
I want to know how i can prevent the user to delete folder or some folder used C# language
thanks
|
|
|
|
|
Unless you want to write a file system extension, you can't.
The best way to do it is assign the appropraite NTFS permissions to the security tab in the folder properties.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I've been working on a problem whereby i'm trying to write an System.Drawing.Image object to an SQL Server database and then reload them from the database back into an System.Drawing.Image object but have come up aginst many brick walls.
I want to try a fresh approach so i need ideas as to how this could be achieved. I'm asking for solutions as I've already asked alot of other people for help on my current way of doing things and they have all been puzzled by the problem.
Thanks
Dafydd
|
|
|
|
|
Hi Everyone,
Again I am posting my probs in this message board.
I want to make a program in which multiple "same" taskbarnotifier(Image) appears at same time looks like MSN messager. When multiple user login on MSN Messager at a same time a pop window(Image) appears right hand side(On the window Screen) "one by one".
I have already created multiple different Image.
When I use two or more different image, it pop up right hand side of window screen one by one, but not the case with same image, it only shows one.
Can you help me out.
Thanks
|
|
|
|
|
Hi,
I'm trying to find a way to connect my c# application to an embedded
webbrowser control in a "finished" application from another company (where I
don't have a chance to modify the source)...
Is there a possibility to connect to the webbrowser control inside this application?
(for example to get the HTML Source of the control?)?
Thanks in advance, Randy
|
|
|
|
|
We have a legacy data struct - in C - basically a two-dimensional set of data accessible thru a C API - much like a DataTable. We want to show this data in a DataGrid and in other related controls. We're looking for a way to write our own C# wrapper class to hold the C struct, and implement the necessary interfaces so that it can be uses with the DataGrid via binding. First of all, does this approach make sense? And if it does, what interface should we implement? I've been looking at IList, but can't quite figure out how the IList interface deals with the 2-dimensional nature of our data.
If anyone chooses to email me directly, remove the x's from the email address first (trying to foil the spambots).
Rich
|
|
|
|
|
I would suggest that you programatically create a DataTable object, stuff it with the data to be displayed and simply point the datagrid at it (set its datasource property). If I understand your problem correctly then I believe this is the most simple way to achieve your goal. I assume that you are wanting to display the data in a datagrid as rows and columns, 2 dimensional?
Is there any reason you can't use a Datatable object as you mentioned in your question?
|
|
|
|
|
Thanks for the quick reply.
I should have mentioned that our data can be VERY large - 100,000+ rows. Obviously we wouldn't want to copy all of that data over to a Datatable before displaying it, plus the duplication of all of that memory. That's why I thought if we could implement a set of interface methods that access the data from our own source, it might be a reasonable approach.
|
|
|
|
|
Ahh right. Well then implement an IList class just as you had planned. If we call your class Bob then use Bob's Item to store each of your structs. Thats the 2D element you were missing! Implement the IList.Add and additionally override Bobs Add mthd with one for the type of the struct. Do this with Remove and whatever else you'll need and you might want to do this with an indexer as well just to make access easy if you're using it for other things outside the grid.
hope that helps.
|
|
|
|
|
Thanks again, but that won't do it. The api for our data "object" uses row and column indexing to access the data using the public API - for example -
void* TABLE_GetValue(TablePtr table, int column, int row);
I guess what I'm asking is what interface and methods must be implemented so that two-dimensional data can be displayed in the datagrid?
Thanks
|
|
|
|
|
So the grid would look something like this right?
RowNum ColNum Data
------- ------- ----------------------
0 0 some data here
0 1 some more data
1 0 data 3 fe
1 1 yet more data
if so, I see no problem with my earlier suggestion, the objects stored in IList impl would be the
result from SomeType* TABLE_GetValue(TblPtr tbl,int col,int row) times n rows for the grid so the
list would look like:
0,0,somedata
0,1,somemoredata
etc...
Is that what we are going for?
If so then maybe some sample code from me would help!
Let me know
|
|
|
|
|
Wow - I really do appreciate your help here!
Ok - you seem to be saying that we have an array of row structs - and the IList can simply give access to a row struct. This is not the case (well, it actually is the case in the internal implementation of our object, but not via the external API that I am using). Via our API, the individual cell values from our table are accessed by specifying column and row to the api - one cell at a time - There is no actual row struct that is externally available - I probably missated this in a previous post. It's more of an array of arrays - that is, an array of rows. In any event, the row arrays do not hold row and column numbers as you indicate (0,0,somedate). Rather, the rows hold an array of void*, each one representing a value for a cell. For example, a 4x4 table looks like this:
row 0: ptr, ptr, ptr, ptr
row 1: ptr, ptr, ptr, ptr
row 2: ptr, ptr, ptr, ptr
row 3: ptr, ptr, ptr, ptr
where the offset into the row array is simply the column number.
So we access a cell by using TABLE_GetValue(table, col, row); There actually is no access for a row since there is no row object or struct concept externally. I guess I've taken a long time saying that this is really like a simple 2-dimensional array with an cell-level access API around it.
Even if I were to return some sort of Row representation by the Item() method, how would the DataGrid know what to do with that row - how to get the values for the individual cells in a row. Would it be expecting the row to also implement IList - so that it essentially would be getting an IList containing a set of ILists?
thanks
Rich
|
|
|
|
|
Let me give you some source code. Check back friday mid day or so.
|
|
|
|
|
Okay, here is some sample code. Sorry it's not real orderly but I just don't have time to make it real nice. I think you'll get the idea though. this code will populate a datagrid with three columns times x rows (just an exmaple, you could have as many columns as you like) from a mock of
what I think your API looks like.
Here is the form
---------------------------------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace SampleOfIList {
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form {
private System.Windows.Forms.DataGrid dataGrid1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1() {
InitializeComponent();
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing ) {
if( disposing ) {
if (components != null) {
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.dataGrid1 = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(8, 8);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(640, 160);
this.dataGrid1.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(656, 197);
this.Controls.Add(this.dataGrid1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main() {
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e) {
dataGrid1.DataSource = new MyIListImpl(new SomeAPI());
// to-do:
// use table column styles to set the order of the columns or else they are
// kind of random.
}
}
}
-------------------------------------------------------------------------------------
here is the sample API (hopefully similar to yours)
using System;
namespace SampleOfIList {
///
/// Just a little mock API with some test data stuffed in. Hopefully not
/// too different from yours but you should get the idea anyway.
///
public class SomeAPI {
// Some place to put mock data
private string[,] internalList;
///
/// ctor and stuff some dummy data in there for illustration only.
/// We'll make it 3x3 for demo purposes.
///
public SomeAPI() {
internalList = new string[3,3];
internalList[0,0] = "r0c0";
internalList[0,1] = "r0c1";
internalList[0,2] = "r0c2";
internalList[1,0] = "r1c0";
internalList[1,1] = "r1c1";
internalList[1,2] = "r1c2";
internalList[2,0] = "r2c0";
internalList[2,1] = "r2c1";
internalList[2,2] = "r2c2";
}
///
/// This is how the outside world can get at our mock data. Similar to your
/// example API.
///
/// <param name="row" />
/// <param name="column" />
/// <returns>
public string GetData(int row,int column) {
return internalList[row,column];
}
///
/// How many rows in the mock data.
///
public int numRows {
get {
return internalList.GetUpperBound(0)+1;
}
}
}
}
-------------------------------------------------------------------------------------------
here is the IList impl
using System;
using System.Collections;
using System.Data;
namespace SampleOfIList {
///
/// An intermediate row object so the grid can deal with it.
///
public struct Row {
public Row(string s1,string s2,string s3) {
c1 = s1;
c2 = s2;
c3 = s3;
}
public string COL_0 {
get { return c1; }
set { c1 = value; }
}
public string COL_1 {
get { return c2; }
set { c2 = value; }
}
public string COL_2 {
get { return c3; }
set { c3 = value; }
}
private string c1;
private string c2;
private string c3;
}
///
/// Implemented the hard way just for illustration, but this is an IList object
/// which supplies the datagrid with data. Just set the DataGrid.DataSoruce member
/// and away it goes.
///
public class MyIListImpl : IList {
private SomeAPI api = null;
public MyIListImpl(SomeAPI api) {
this.api = api;
}
void ICollection.CopyTo(Array arr,int index) {
throw new ArgumentException("CopyTo - Not implemented");
}
int ICollection.Count {
get {
return api.numRows;
}
}
bool ICollection.IsSynchronized {
get {
throw new ArgumentException("IsSynchronized - Not implemented");
}
}
object ICollection.SyncRoot {
get {
throw new ArgumentException("SyncRoot - Not implemented");
}
}
IEnumerator IEnumerable.GetEnumerator() {
throw new ArgumentException("GetEnumerator - Not implemented");
}
int IList.Add(object obj) {
throw new ArgumentException("Add - Not implemented");
}
void IList.Clear() {
throw new ArgumentException("Clear - Not implemented");
}
bool IList.Contains(object o) {
throw new ArgumentException("Contains - Not implemented");
}
int IList.IndexOf(object o) {
throw new ArgumentException("IndexOf - Not implemented");
}
void IList.Insert(int ix,object o) {
throw new ArgumentException("Insert - Not implemented");
}
bool IList.IsFixedSize {
get {
return true;
}
}
bool IList.IsReadOnly {
get {
return true;
}
}
void IList.Remove(object o) {
throw new ArgumentException("Remove - Not implemented");
}
void IList.RemoveAt(int ix) {
throw new ArgumentException("RemoveAt - Not implemented");
}
///
/// Here is the meat of the thing!
///
object IList.this[int ix] {
get {
Row row = new Row(api.GetData(ix,0),api.GetData(ix,1),api.GetData(ix,2));
return row;
}
set {
throw new ArgumentException("Indexer//Set - Not implemented");
}
}
}
}
--------------------------------------------------------------------------------------
hope that helps.
|
|
|
|
|
I was interested in how to accomplish this:
Say I have a textbox on form1.cs. I would like to print messages into that textbox from other class files such as work.cs
I am sure this is very simple and I am an idiot hehehehe
Can someone help me out?
|
|
|
|
|
Just make a public property in the other class for the text of the text box, and within it you will be able to get the value of it like :
class Work<br />
{<br />
TextBox t = new TextBox();<br />
public string TextT<br />
{<br />
get{return this.t.Text;}<br />
}<br />
}<br />
class form1<br />
{<br />
TextBox holder = new TextBox();<br />
holder.Text = Work.TextT;<br />
<br />
}<br />
But this must be have the same namespace or in the same directory ,or at least make a reference to the dll that contains that class Work .
|
|
|
|
|
Thanks for the reply!
I have attached a zip with a sample project which (I think) illustrates my problem.
If you have some time to spare, could you take a look at it?
Thanks and sorry for my pretty rookie problems...
http://www.djnokturnal.com/downloads/TextBoxes.zip[^]
|
|
|
|
|
Hello dear all
i have very big problem
i have a exe that exe will generate from C# windows application i want to use these exe method to another project of C# windows application
when i want to use this exe method from "Add reference" then it will give on error Message that is
"Converting the type library to .NEt Assembly failed type library was export from a CLR assembly and can not be re-imported as a CLR Assembly"
but i have used this type library in VB6.0 project
so how we can use this type library in .NET project Application
Please Help ME
|
|
|
|
|
The only way to think is to make that exe dll as you will move your code to a control library project and add a reference to it from your exe and in youe exe make an instance of the class that is in the dll ,,so..
as this you can use it in any number of exe ,by just instantiating this class that you want to be in the exe ,from the dll.
|
|
|
|
|