|
CAN YOU TELL ME WHERE I CAN POST ?
|
|
|
|
|
|
Ok, i think you missunderstood something.
The page already exists and i want to write a Windows Forms Application in C#.
I never worked with the NET libraries of .NET before and i've read a lot and tried to start. And as OriginalGriff told me to debug, i've already done...
I found an article with "How to login to gmx with C#" and i start to build.
I just want to know how to use the WebBrowser without using it as controle, how to fill fields, press buttons and wait for an response. I hoped that you can give me some usefull links with some explanations or some open source software to read and rewrite.
|
|
|
|
|
Hi,
if you don't want a user to interact with a WebBrowser Control, then you should not use one.
Use HttpRequest and HttpResponse classes instead.
|
|
|
|
|
There are a lot of things in your code which could be causing this, and the best way to help you is not for me to guess! You need to learn how to debug this - you will be doing this a lot, so learn now.
Put a break point on the line "WebBrowser wb = new WebBrowser();" and run your program in the debugger. When it stops on the line, use the single step ("Step Into") button on you toolbar to follow the code through. Check before you execute what the contents of each variable are - you will soon find the null reference.
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
I am iterating through all of the bookmarks in a word document.
I am able to retrieve the bookmark names, but unsure how to retrieve the bookmark values?
Here's a code snippet that I'm using to get the bookmark names and it's working great, but I also
need to get the value (text) for each bookmark.
Microsoft.Office.Interop.Word.Document doc = oWord.Documents.Open(... arguments...);
doc.Activate();
for (int i = 1; i <= doc.Bookmarks.Count; i++)
{
object bkmk = i;
MessageBox.Show("Bk: " + doc.Bookmarks.get_Item(ref bkmk).Name);
}
Thanks for any help.
|
|
|
|
|
Maybe this will work for you:
string value = doc.Bookmarks.get_Item(ref bkmk).Range.Text;
|
|
|
|
|
Hi. I would like to be able to bring up another form for editing data in Detail view when click on a row in gridview. these or the code that i'm workin with but don't seem to be working. Anyone help me or show me another easier way to do it
// EmployeesViewForm.cs ////This the GridviewForm
class EmployeesViewForm : Form {
...
void addToolStripButton_Click(object sender, EventArgs e) {
this.EditEmployee(this.employeesBindingSource.AddNew());
}
void updateToolStripButton_Click(object sender, EventArgs e) {
this.EditEmployee((DataRowView)this.employeesBindingSource.Current);
}
void EditEmployee(DataRowView item) {
// Pass to child employee details form
EmployeesEditForm dlg = new EmployeesEditForm(item);
if( dlg.ShowDialog() == DialogResult.OK ) {
// Reset to reflect changes automatically
this.employeesBindingSource.ResetCurrentItem()
}
}
// EmployeesEditForm.cs
// EmployeesEditForm.cs //// This the form with detail View
partial class EmployeesEditForm : Form {
...
void EmployeeItemForm_FormClosing(
object sender, FormClosingEventArgs e) {
// Cancel edit if Cancel button is pressed or form is closed from
// either the system menu or close box
if( (e.CloseReason == CloseReason.UserClosing) ||
(this.DialogResult == DialogResult.Cancel) ) {
this.employeesBindingSource.CancelEdit();
}
}
}
|
|
|
|
|
Well, Sparky, we can't read it because it's not formatted properly.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
<big> <br />
class EmployeesViewForm : Form <br />
{<br />
<br />
void addToolStripButton_Click(object sender, EventArgs e) <br />
{<br />
this.EditEmployee(this.employeesBindingSource.AddNew());<br />
}<br />
<br />
void updateToolStripButton_Click(object sender, EventArgs e) <br />
{<br />
this.EditEmployee((DataRowView)this.employeesBindingSource.Current);<br />
}<br />
<br />
void EditEmployee(DataRowView item) <br />
{<br />
EmployeesEditForm dlg = new EmployeesEditForm(item);<br />
if( dlg.ShowDialog() == DialogResult.OK ) <br />
{<br />
this.employeesBindingSource.ResetCurrentItem()<br />
}<br />
}<br />
<br />
<br />
<big> partial class EmployeesEditForm : Form <br />
{<br />
<br />
void EmployeeItemForm_FormClosing(<br />
object sender, FormClosingEventArgs e) <br />
{<br />
if( (e.CloseReason == CloseReason.UserClosing) ||<br />
(this.DialogResult == DialogResult.Cancel) ) {<br />
this.employeesBindingSource.CancelEdit();<br />
}<br />
}<br />
<br />
<br />
<br />
<big><br />
partial class EmployeesEditForm : Form <br />
{<br />
<br />
public EmployeeItemForm(object item) <br />
{<br />
<br />
if( (item is DataRowView) &&<br />
(((DataRowView)item).Row is NorthwindDataSet.EmployeesRow) ) <br />
{<br />
InitializeComponent();<br />
<br />
this.employeesBindingSource.DataSource = item;<br />
}<br />
else throw new ArgumentException("Incorrect type");<br />
}<br />
<br />
}
|
|
|
|
|
I'm trying to implement a checkbox in a DataGridView in a WinForms app. I am creating the DataTable, then binding it to the DataGridView:
DataTable table = new DataTable();
table.Columns.Add("ColumnId", typeof(int));
table.Columns.Add("QueryId", typeof(int));
table.Columns.Add("TableId", typeof(int));
table.Columns.Add("TableName", typeof(string));
table.Columns.Add("ApexColumnName", typeof(string));
table.Columns.Add("Expression", typeof(string));
table.Columns.Add("MyCheckBox", typeof(bool));
dsGrid.Tables.Add(table);
grdData.DataMember = dsGrid.Tables[0].TableName;
grdData.DataSource = dsGrid.Tables[0];
The checkbox column appears, but when I add a row, the check the checkbox, nothing happens. No checkbox appears.
Everything makes sense in someone's mind
|
|
|
|
|
The ReadOnly property on that column is probably set to true.
|
|
|
|
|
I set it to true, and no change.
When a checkbox is set to true in code, and cannot be unchecked when run
Everything makes sense in someone's mind
|
|
|
|
|
Try building the DataGridViewColumns instead of letting the datagridview create for you. Also check if the column in datatable is readonly (if there's such a flag, seldom use datatable for displaying nowadays).
|
|
|
|
|
Good morning.
I am trying to figure out how to set the focus to a textbox when a user clicks on ctrl + L. I have the following:
private void button1_Click(object sender, EventArgs e)
{
this.tstbAddress.Focus();
}
When I tried this in and of the key methods, it didn't work. I have a webbrowser control on the form. I thought it might have something to do with (lack of) focus.
Any suggestions? Thank you, WHEELS
|
|
|
|
|
Hi Wheels
In the forms KeyDown event you will have access to more in the KeyEventArgs so you can identify if the control key and L key are being pressed at the same time. You will need to set the KeyPreview property to true on the form then the following will work
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyValue == 76)
textBox1.Focus();
}
The FoZ
|
|
|
|
|
I put the following code in the Form1_Load:
this.KeyPreview = true;
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
and I have the following event:
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyValue == 76)
this.tstbAddress.Focus();
}
Unfortunately this only works when the form has focus. I'm not sure how to give the form focus. I used a button to give the form focus and the Ctrl+L worked.
Any suggestions? WHEELS
|
|
|
|
|
I would guess that you could put the KeyDown event code on the form that has the button. Is this an MDI application?
The FoZ
|
|
|
|
|
I would guess that you could put the KeyDown event code on the form that has the button. Is this an MDI application?
The FoZ
This is not a MDI app. Just a Winform with a web browser control. Someone types in a URL it the address textbox and it navigates to the webpage.
The KeyDown code is in Form1_KeyDown. The button I created is temporary and I used it just to set the focus to the form to test the Ctrl + L.
WHEELS
|
|
|
|
|
Hi Wheels
If the form does not have focus am I right to assume that the application does not have focus? If this is the case then you will not need the button to make your form have focus, just click on the form
The FoZ
|
|
|
|
|
Good morning The FoZ.
I believe the web browser may have the focus, but I added a toolbar menu item which triggers on Ctrl + L and made it hidden.
Seems to work well.
Thank you for the assistance, WHEELS
|
|
|
|
|
TheFoZ wrote: e.KeyValue == 76
what is this nonsense? you should NEVER have magic constants in the middle of code.
How about e.KeyCode==Keys.L ?
|
|
|
|
|
Luc Pattyn wrote: what is this nonsense? you should NEVER have magic constants in the middle of code.
How about e.KeyCode==Keys.L?
True. Still being quite new C# I did not know about the Keys.L . Thanks for the info
The FoZ
|
|
|
|
|
Language - c#
Database - sql server 2008
DataGridview
It is regarding the sorting in the datagridview using generic classes as a datasource of datagridview
I need suggestion for my implementation that whether my approach is right or wrong
Following are the function.
private void datagridview1_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
SetSorting(e.ColumnIndex);
}
private void SetSorting(int ColumnIndex)
{
if (ColumnIndex == -1) return;
IList<classInfo> data = null;
try
{
data = (IList<classInfo>)dgvUploadCharts.DataSource;
SortOrder order = SortGlyphDirectionPublication(ColumnIndex);
dgvUploadCharts.DataSource = SortingDataPublication(data, order, ColumnIndex);
dgvUploadCharts.Columns[ColumnIndex].HeaderCell.SortGlyphDirection = order;
}
catch (Exception ex)
{
throw ex;
}
finally
{
data = null;
}
}
private IList<classInfo> SortingDataPublication(IList<classInfo> Obj, SortOrder SortOrder, int ColumnIndex)
{
IEnumerable<classInfo> sortedEnum = null;
try
{
if (datagridview1.Columns[ColumnIndex].Name.ToString() == Enumeration.Enum1.ToString())
{
if (SortOrder == SortOrder.Ascending || SortOrder == SortOrder.None)
sortedEnum = Obj.OrderBy(f => f.Enum1);
if (SortOrder == SortOrder.Descending)
sortedEnum = Obj.OrderByDescending(f => f.Enum1);
return sortedEnum.ToList();
}
}
}
private SortOrder SortGlyphDirectionPublication(int ColumnIndex)
{
SortOrder order = datagridview1.Columns[ColumnIndex].HeaderCell.SortGlyphDirection;
if (order == SortOrder.None)
return SortOrder.Ascending;
if (order == SortOrder.Ascending)
return SortOrder.Descending;
if (order == SortOrder.Descending)
return SortOrder.Ascending;
return SortOrder.Ascending;
}
|
|
|
|
|
abcurl wrote: I need suggestion for my implementation that whether my approach is right or wrong
The easiest way to determine whether your implementation is right, is by testing it. Well, does it work?
Looks readable enough, why are you doubting?
I are Troll
|
|
|
|