|
Hi everybody,
I'm trying to develop an application that will send some type of alert(text message) to a cell phone when a certain event occurs. Where do I start? Where can I find more information on doing this? I'm using C# in MS VS.NET 2003
|
|
|
|
|
|
hi i want to set property of controls in one form from other forms and i test all ways (for example public modefiers,define property that return control.property , ...) and don't gave result .
please help me ...
|
|
|
|
|
set the modifiers on textbox1 to public.
if this doesn't fix the problem, post the code you are using.
|
|
|
|
|
hi thanks to your instruction but don't get result for change textbox1 modefier to public . here is my code :
//in form 1 (modifier of textbox1 is public):
this.textbox1.text = "hello";
//in form 2 (for example):
Form 1 f = new Form1();
//this line should be display Form1.textbox1.text in Form2.label1.text but doesn't it :
this.label1.text = f.textbox1.text;
|
|
|
|
|
this.textbox1.Text = "hello"; needs to be in the constructor of Form1, otherwise textbox1.text will contain the default value "" (nothing) until it is assigned to. Also, the textbox needs to be initialized before this happens.
You might also try telling the label to redraw itself after its text value gets reassigned: this.label1.Invalidate();
public System.Windows.Forms.TextBox textbox1;
public Form1()
{
this.textbox1 = new System.Windows.Forms.TextBox();
...
this.textbox1.Text = "hello";
}
Form1 f = new Form1();
this.label1.Text = f.textbox1.Text;
this.label1.Invalidate();
To see if things are working, you can try this:
public System.Windows.Forms.TextBox textbox1;
public Form1()
{
this.textbox1 = new System.Windows.Forms.TextBox();
...
}
Form1 f = new Form1();
f.textbox1.Text="hello"
this.label1.Text = f.textbox1.Text;
this.label1.Invalidate();
|
|
|
|
|
hi,
i'm trying to update a database by a datatable through a stored prcedure like that :
private void button2_Click(object sender, System.EventArgs e)<br />
{<br />
Cursor =Cursors.WaitCursor; <br />
if(MessageBox.Show("are you sure you want to Delete","Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2) == DialogResult.Yes)<br />
{<br />
dataSet6.Tables["SELECT_STAFF_REAL"].Rows[x].Delete();<br />
try<br />
{<br />
DataTable table1=dataSet6.Tables["SELECT_STAFF_REAL"].GetChanges();<br />
if(table1!=null) <br />
{<br />
sqlDataAdapter6.Update(table1); <br />
dataSet6.Tables["SELECT_STAFF_REAL"].AcceptChanges();<br />
<br />
gridEx1.DataSource=dataSet6.Tables["SELECT_STAFF_REAL"];<br />
}<br />
}<br />
catch(Exception err)<br />
{<br />
MessageBox.Show(err.Message);<br />
}<br />
}<br />
rowCount--;<br />
Cursor =Cursors.Default;<br />
}
and this is the stored procedure:
CREATE procedure select_staff_real @job varchar(20) ,@field varchar(20)<br />
as<br />
SELECT STAFF.S_SSN, STAFF.S_NAME AS Name, STAFF.S_USER_NAME, STAFF.S_PASS_WORD, STAFF.S_E_MAIL AS [E-Mail], STAFF.S_ADDRESS, STAFF.S_CITY, STAFF.S_PHONE_NUMBER AS [Home Phone], STAFF.S_MOBILE_NUMBER AS [Mobile Phone], STAFF.S_SALARY, STAFF.S_COMMENT, DESIGNATION.D_ID, DESIGNATION.D_TYPE AS Designation, STAFF.S_DESIGNATION_ID FROM STAFF INNER JOIN DESIGNATION ON STAFF.S_DESIGNATION_ID = DESIGNATION.D_ID<br />
<br />
where d_type like '%'+@job+'%' and s_name like '%' +@field +'%'<br />
GO
and i have error that tells me that the parameter @job must be assigned to a value.
so my question is what is the reason of that error.
or how to update a datasource by using stored procedure
thanx
|
|
|
|
|
I can successufully add a context menu along with items and appropriate actions to a datagrid. However, when I left click "into" a cell and then right click the same cell, the standard menu (COPY, PASTE, etc) appears. Only by right clicking the grid (anywhere other than the cell left-clicked) does my context menu appear. I suppose that the underlying control is being exposed which is tied to the system's context menu.
My question is: Can I get around this somehow? Can I somehow bind my context menu to the underlying control?
OrbeaOrca
|
|
|
|
|
Hello everyone, Ive been trying to get my program to function for quite some time now and havent been able to get any clear answers. its a simple practice app basically, when I click a button on my form, I want the app to press a button in another form. that simple. seemed like it at least, but when I try to use this it doesnt work.
int a = Win32.FindWindow(txtClassName2.Text, Title.Text);
int b = Win32.SendMessage(a, Win32.BM_CLICK, 0, 0);
when I replace Win32 with Win32API, then theres a problem with SendMessage not being part of the current selection, also there is a problem with FindWindow with Win32API. FindWindowEx doesnt work either. When I use Win32, they work work but BM_CLICK doesnt work. its like I have to choose which problem to go with, I havent been able to figure this out. this is actually the whole code in the form.cs file:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace test
{
public partial class Form1 : Form
{
[DllImport("user32", EntryPoint = "GetNextWindow")]
public static extern int
GetWindow(IntPtr hwnd, int wFlag);
public Form1()
{
InitializeComponent();
}
public class Win32
{
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
public const int BM_CLICK = 0xF5;
[DllImport("user32.dll")]
public static extern int FindWindow(string lpClass, string lpWindow);
[DllImport("user32.dll")]
public static extern int SendMessage(int hWnd, uint Msg, int wParam, int lParam);
}
private void button1_Click(object sender, EventArgs e)
{
int hWnd;
//Thread.Sleep(5000);
if ((txtWindowCaption.Text == "") && (txtClassName.Text == ""))
{
hWnd = Win32API.FindWindowAny(0, 0);
}
else if ((txtWindowCaption.Text == "") && (txtClassName.Text != ""))
{
hWnd = Win32API.FindWindowNullWindowCaption(txtClassName.Text, 0);
}
else if ((txtWindowCaption.Text != "") && (txtClassName.Text == ""))
{
hWnd = Win32API.FindWindowNullClassName(0, txtWindowCaption.Text);
}
else
{
hWnd = Win32API.FindWindow(txtClassName.Text, txtWindowCaption.Text);
}
if (hWnd == 0)
{
MessageBox.Show("Specified window is not running.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
// Set the window foreground.
Win32API.SetForegroundWindow(hWnd);
// if window is minimized, simply restore, otherwise show it. Notice the
// declaration of Win32API.IsIconic defines the return value bool
// allowing .NET to marshall the integer value to a bool.
if (Win32API.IsIconic(hWnd))
{
Win32API.ShowWindow(hWnd, Win32API.SW_RESTORE);
}
else
{
Win32API.ShowWindow(hWnd, Win32API.SW_SHOW);
}
int a = Win32.FindWindow(txtClassName2.Text, Title.Text);
int b = Win32.SendMessage(a, Win32.BM_CLICK, 0, 0);
}
}
}
}
anyone got any advice? thanks
|
|
|
|
|
anyone got at least a code sample of a program like this is a sample app? I couldnt find one on code project...
|
|
|
|
|
Trying to combine dbRecords that overlap to display as one unit on treeView.
so rather than looking like:
+ dept1<br />
+ dept2<br />
+ dept2<br />
+ dept2<br />
+ dept3<br />
+ dept3<br />
+ dept4
I want it to look like:
+ dept1<br />
+ dept2<br />
+ dept3<br />
+ dept4
Using TreeNodeCollection.Contains Method to acheive this goal, but its not working. It seems that becuase i'm recreating the TreeNode object [TreeNode myNode = new TreeNode() ] on each new loop it doesn't have anyway to refrenece the data i've already written. This makes sense, but it seems odd that i can't refrence the pre-written data inside of the tree.
I've tried refrenceing the actual TreeView, (tView.Nodes.Contains(myNode)
I've tried the locally written TreeNode (DeptNode.Nodes.Contains(myNode)
I've tried doing a foreach loop[foreach(TreeNode node in tView.Nodes) ] and checking doing if(node.Tag == myNode.Tag)
I've tried removing the recreation of the TreeNode so it refrences the same node object when doing the search
(i only ended up with the expected result of only adding the newest node to the TreeView rather than several new nodes)
and pretty much i'm at wits end on what would work...
Here's the code:
private void TelList()
{
statusBarPanel1.Text = "Please Wait While We Update the List";
PhoneTree.Nodes.Clear();
TreeNode ParentNode = new TreeNode("Phone List");
TreeNode Purge = new TreeNode("Purge");
PhoneTree.Nodes.Add(ParentNode);
PhoneTree.Nodes.Add(Purge);
while (TreeRead.Read())
{
TreeNode DeptNode = new TreeNode();
TreeNode TelNode = new TreeNode();
TreeNode ModNode = new TreeNode();
DeptNode.Text = TreeRead.GetString(7);
DeptNode.Tag = TreeRead.GetValue(4);
ModNode.Text = TreeRead.GetString(2);
ModNode.Tag = TreeRead.GetValue(4);
TelNode.Text = TreeRead.GetString(3);
TelNode.Tag = TreeRead.GetValue(2);
if (ParentNode.Nodes.Contains(DeptNode))
{
if (ModNode.Tag == DeptNode.Tag)
{
if (DeptNode.Nodes.Contains(ModNode))
{
if (ModNode.Nodes.Contains(TelNode))
{continue;}
else
{
ModNode.Nodes.Add(TelNode);
}
}
else
{
DeptNode.Nodes.Add(ModNode);
}
}
if (TelNode.Tag.ToString() == ModNode.Text)
{
ModNode.Nodes.Add(TelNode);
}
}
else
{
ParentNode.Nodes.Add(DeptNode);
if (ModNode.Tag == DeptNode.Tag)
{
if (DeptNode.Nodes.Contains(ModNode))
{
ModNode.Nodes.Add(TelNode);
}
else
{
DeptNode.Nodes.Add(ModNode);
}
}
if (TelNode.Tag.ToString() == ModNode.Text)
{
ModNode.Nodes.Add(TelNode);
}
}
}
TreeRead.Close();
TreeConn.Close();
}
![Sigh | :sigh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_sigh.gif)
|
|
|
|
|
|
I am using .Net Framework 2.0 winforms groupbox control. I would want to know on how to change the border color of the groupbox . Any ideas on how this would be achieved would be appreciated.
Thanks,
VPMahank
|
|
|
|
|
Not easily done.
You can only achieve this by extending the groupbox class, and painting it yourself.
|
|
|
|
|
The problem:
I want to allow an administrator (user) to create a list of teachers, each teacher in turn has a list of classes, each class has a list of students.
There's an article at http://aspalliance.com/721 that describes making classes for the Student and the StudentList, but I'm wondering how to make classes that are collections of the other classes, ie a ClassList that holds the StudentList class and a TeacherList class that holds the ClassList class.
TeacherList-->ClassList-->StudentList-->Student
What is the approach to use to make a custom object that could handle this nesting?
The article mentioned above has a StudentList Class that inherits from IEnumerable and uses a Hastable to hold the Student objects that are made up of simple data types. I tried making classes in a similar fashion for the ClassList and StudentList collections, but I'm having casting errors, so I'm not sure that this is the correct approach or my implementation is not correct.
Anyone have any ideas or suggestions as to how to nest collections like this? or another approach to accomplish the same thing? If you want to see the code I've tried, I can post it.
Thanks,
Paul
|
|
|
|
|
The design using a HashTable to hold the objects is sound.
I would make a TeacherList object that is a list of Teacher objects. The Teacher object would contain a ClassList object that is a list of SchoolClass objects (as Class is obviously not a good name). The SchoolClass object contains a StudentList object, which is a list of Student objects.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa:
I just got a reply elsewhere that pointed out the same error that you did, ie, that I don't have a teacher or a class object and that I cannot use the list objects in their place.
> A TeacherList would not hold a ClassList.
>
> A TeacherList has 0-n Teacher objects.
> A Teacher has 1 ClassList
> A ClassList has 0-n Class objects.
> A Class has 1 StudentList
> A StudentList has 1-n Student objects.
I'm working on the solution now. Hopefully, I'll construct it correctly.
Thank you,
Paul
-- modified at 15:49 Tuesday 7th February, 2006
|
|
|
|
|
Well, you could make the TeacherList contain ClassList objects, but then it would hardly be a teacher list, it would just be a ClassList list. A teacher object would probably contain some more information than just the class lists, like the name of the teacher, to start with.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I have project when I want to keep all commonly used variables and structures and refer in project. (Like we do using include files in C r C++)
Could any one tell how to do this.
Thanks and Regards,
Subbu
|
|
|
|
|
Add a class file to the project. In the class you put static members.
Also make the class sealed, and make a private constructor in the class. That way it's obvious that one is not supposed to inherit or create objects from the class.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
Thanks for ur information.
Suppose I want structure(struct) data type which is used accross all the files in the project ...what should I do?
Thanks and Regards,
Subbu
|
|
|
|
|
Put it in the namespace in the class file.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
i have a program which is using AxWebBrowser. It was working well under .net framework 1.1. But after upgrading .net framework 2.0, at SOME systems, i receive the error below:
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at SHDocVw.IWebBrowser2.Navigate(String URL, Object& Flags, Object& TargetFrameName, Object& PostData, Object& Headers)
at AxSHDocVw.AxWebBrowser.Navigate(String uRL, Object& flags, Object& targetFrameName, Object& postData, Object& headers)
does anyone know why it occurs, and how can i fix that problem?
thanks.
ozgur.nevres
|
|
|
|
|
On these "SOME" systems, do they have IE 6.0 SP1 or greater installed? Under .NET 1.0 and 1.1, only IE 5.0 was required. This changed to IE 6.0 SP1 under .NET 2.0.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you, i'll ask it to our clients. But one of our client who is getting this error, has aldready installed ie7.0 Beta. Does it cause the same problem?
ozgur.nevres
|
|
|
|
|