|
hi there,
u can download a webpage from a site by using HttpWebrequest/HttpwebResponse (these are supported in .net, sorry I do not remember exactly the class name)
after downloading the content of a web page, just simply do parsing from the content to find out all hyperlinks in the page
Hope that helps
<< >>
|
|
|
|
|
Access the web page through code and get it as web response. Use REGEX to extract all the available hrefs.
- ashish
|
|
|
|
|
In the Style definitions for a DataGrid I defined a DataGridBoolColumn to show Boxes for
the true/false-values in the DataView of the Grid.
To set/toggle Buttons I have to check out, if the Box in a [Row,Column] is set to Enable or Disable by the click-event / space-key (if cell selected).
I have included an eventhandler (DataChanged) for the DataTable which is bound to the Grid.
But only if the SelectedCell is changed, the event for DataChanged will be fired. So, how can I receive an event for the changed Value in the Box if the user do not change the Cell (only 1 Click in the Box to mark it) and won't leave the DataGrid (events validating/valdated therefore will not be fired) ?
Any Idea ?
- If Data is changed, you can see the shown pencil at the row-marker-column. May I fetch this event inside the Grid in any way? May this be a workaround?
|
|
|
|
|
JuergenLissmann wrote:
So, how can I receive an event for the changed Value in the Box
try TextChanged event for that particular columnStyle..
|
|
|
|
|
Hello!
I use dlPortio.dll for Communication With parallel ports in visual C++ 0.6
But I cann't used this Dll in the visual studio .NET (C# or vc++) .
please help me.
|
|
|
|
|
|
|
I've been trying to write data to my database, but it seems like the last change I attempt won't work. The database is an Access 2003 file, and uses Jet 4.0 for the provider.
I'm currently only developing an application to write data to one table of the database, "Employees."
Employees Table
-Primary Key: EmployeeID (Employee's SSN, unformatted)
-FirstName
-MiddleInitial
-LastName
-PayRate
-FICA
-SSI
-Tax
-SalesPersonID
It's rudimentary, I know, but I'll work on expanding the database later.
The application I currently use consists of nine textBoxes (textBox1 ... textBox9), two buttons -- a Clear button (button1), and an Update button (button2) -- a dataConnection control (dcFusion), a DataAdapter(daEmployees), and a dataSet(dsEmployees). The form name is Form1.
The textBoxes are data bound to each column in the database, in the order that I've listed them. (i.e. textBox1 is bound to Employees.EmployeeID).
Here's my Update method:
private void button2_Click(object sender, System.EventArgs e)<br />
{<br />
dsEmployees.Employees[comboBox1.SelectedIndex].EmployeeID = Convert.ToInt32(textBox1.Text);<br />
dsEmployees.Employees[comboBox1.SelectedIndex].FirstName = textBox2.Text;<br />
dsEmployees.Employees[comboBox1.SelectedIndex].MiddleInitial = textBox3.Text;<br />
dsEmployees.Employees[comboBox1.SelectedIndex].LastName = textBox4.Text;<br />
dsEmployees.Employees[comboBox1.SelectedIndex].PayRate = Convert.ToDecimal(textBox5.Text);<br />
dsEmployees.Employees[comboBox1.SelectedIndex].FICA = Convert.ToDecimal(textBox6.Text);<br />
dsEmployees.Employees[comboBox1.SelectedIndex].SSI = Convert.ToDecimal(textBox7.Text);<br />
dsEmployees.Employees[comboBox1.SelectedIndex].Tax = Convert.ToDecimal(textBox8.Text);<br />
dsEmployees.Employees[comboBox1.SelectedIndex].SalesPersonID = textBox9.Text;<br />
dcFusion.Open();<br />
daEmployees.Update(dsEmployees, "Employees");<br />
daEmployees.Fill(dsEmployees, "Employees");<br />
dcFusion.Close();<br />
}
When the dataSet refreshes, the change I enter reverts back to what is already in the database, and no change is made, even after calling the Update method of my dataAdapter. What am I doing wrong here?
-- modified at 23:00 Sunday 18th September, 2005
|
|
|
|
|
To push changes you make in the dataset object to the database, you must first reconnect, then use the same data adapter object that you used to retreive the data to update the database.
//modify
dsEmployees.Tables["tablename"].Rows[0]["EmployeeID"] = Convert.ToInt32(textBox1.Text);
//Check the row
//you can also check the RowState value to see if it's been set to modified.
if(dsEmployees.Tables["tablename"].Rows[0].RowState == System.Data.DataRowState.Modified)
{
//update
objConnection.Open();
adapter.Update(dataset, "tablename");
objConnection.Close();
}
else
{throw new Exception("RowState not modified");}
|
|
|
|
|
To push changes you make in the dataset object to the database, you must first reconnect, then use the same data adapter object that you used to retreive the data to update the database.
//modify
dsEmployees.Tables["tablename"].Rows[0]["EmployeeID"] = Convert.ToInt32(textBox1.Text);
//Check the row
//you can also check the RowState value to see if it's been set to modified.
if(dsEmployees.Tables["tablename"].Rows[0].RowState == System.Data.DataRowState.Modified)
{
//update
objConnection.Open();
adapter.Update(dsEmployees, "tablename");
objConnection.Close();
}
else
{throw new Exception("RowState not modified");}
|
|
|
|
|
Hmm... Turns out, the issue was with the dataBound textBoxes. Somehow when a change was made to them, it wasn't modifying the RowState property. I removed the dataBinding and populated the textBoxes programattically. Works now. Would anyone know why the dataBound textBoxes weren't allowing the Update to filter through?
|
|
|
|
|
hi to all,
i am trying to get the bytes size of a file so i can display in statusbar, also updated as typed.
i first tried getting the encoding of the file and using getbytes() of the encoder, but it didnt come up the same as Windowx Explorer, then i tried just to get the char count and multiply * 2 but it still not work.
how is this acheived ?
this is my encoder attempt
<br />
string byteSuffix = "B";<br />
<br />
string text = this.context.Text;<br />
if(text == null) text = "";<br />
<br />
byte[] bytes = this.encoder.GetBytes(text);<br />
<br />
double size = bytes.LongLength;<br />
<br />
string adjustedSize = "0.0";<br />
string byteSize = "0.0"; <br />
<br />
if(size >= 1000000000)<br />
{<br />
byteSuffix = "GB";<br />
byteSize = size + ""; <br />
size = size / Math.Pow(2, 30); <br />
adjustedSize = size.ToString("N2"); <br />
}<br />
else if(size >= 1000000)<br />
{<br />
byteSuffix = "MB"; <br />
byteSize = size + ""; <br />
size = size / Math.Pow(2, 20); <br />
adjustedSize = size.ToString("N2");<br />
}<br />
else if(size >= 1000)<br />
{<br />
byteSuffix = "KB"; <br />
<br />
byteSize = size + ""; <br />
size = size / Math.Pow(2, 10); <br />
adjustedSize = size.ToString("N2");<br />
}<br />
<br />
this.statusFileSize.Text = adjustedSize + " " + byteSuffix;<br />
this.statusFileSize.ToolTipText = adjustedSize + " " + byteSuffix + " (" + byteSize + " bytes)"<br />
this is how i get encoder
<br />
StreamReader reader = null;<br />
<br />
try<br />
{<br />
reader = new StreamReader(this.path, true);<br />
<br />
this.Content = reader.ReadToEnd();<br />
this.encoder = reader.CurrentEncoding; <br />
this.Encoding = encoder.EncodingName;<br />
<br />
reader.Close();<br />
<br />
if(this.encoder == null)<br />
{<br />
this.encoder = ASCIIEncoding.Unicode;<br />
this.Encoding = encoder.EncodingName;<br />
}<br />
}<br />
catch (Exception e)<br />
{<br />
Debug.WriteLine("Error: " + e.Message);<br />
}<br />
finally<br />
{<br />
if(reader != null) reader.Close();<br />
} <br />
kind regards,
g00fy
|
|
|
|
|
You can try using the simple alternative of FileInfo.Length property to get the size of a file in bytes. If strMyFile represents the full name-path of the your file, then
FileInfo fiMyFile = new FileInfo(strMyFile);
long lLengthMyFile = fiMyFile.Length;
This will give the size of your file in bytes. Use the "using System.IO;" at the beginning for accessing FileInfo class.
Regards,
Ashok Dhamija
_____________________________
Padam Technologies
|
|
|
|
|
easy when you know how eh
just hard to google for some things
thank you
g00fy
|
|
|
|
|
is there another way though, this is fine when i open a file, but i would like to update the size as i type into the file to use this method i would have to save file after each keystroke.
kind regards,
g00fy
|
|
|
|
|
Try using Refresh() method of FileInfo class before calling the Length property every time you want to update it, i.e.,
fiMyFile.Refresh();
lLengthMyFile = fiMyFile.Length;
Though I have not checked it in the context of your application (but it worked in my application having some different requirements), it may work if the character is being written in the file as it is being typed.
Another way out could be to use the Length property of FileInfo as above as and when you save the file. And, after that as the characters are being typed, you keep a count of the characters / bytes of the unsaved data and add it to the Length calculated earlier for the saved data.
I hope it works.
Regards,
Ashok Dhamija
_____________________________
Padam Technologies
-- modified at 1:13 Monday 19th September, 2005
|
|
|
|
|
How best to declare/cycle 3 Pens on a Windows Form.
By "cycle" I mean that I want to iterate through the pens based on
button events...thanks
|
|
|
|
|
Don't declare the Pen locally. Declare and define the Pen at the form level, and pass parameters to the pen with the Button click.
|
|
|
|
|
Unless they are not one pixel wide pens, just use the Pens enumeration instead of creating your own.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I use a Panel as drawing zone and set AutoScroll = True, hoping a scroll will be attached to it automatically when I draw large drawings. But it does not happen. How can I make it?
Appreciate any advice!
Radic
|
|
|
|
|
Hoho! I get it!
Put another panel as the container of the drawing zone and set AutoScroll = True. When drawing, if the figure is close to the width and height of the drawing zone, increase the width and height!
Excited!
|
|
|
|
|
hi,
i have problems with my setup project...i want attach the dll files...so that the appl can be started without installed net framework:
but
<br />
------ Build started: Project: Sender, Configuration: Debug .NET ------<br />
<br />
Preparing resources...<br />
Updating references...<br />
Performing main compilation...<br />
<br />
The project is up-to-date.<br />
Building satellite assemblies...<br />
<br />
<br />
<br />
------ Starting pre-build validation for project 'Setup' ------ <br />
ERROR: Unable to find file 'sorttbls.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'prcp.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'culture.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'l_except.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'prc.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'region.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'CharInfo.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'bopomofo.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'ksc.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'xjis.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'l_intl.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'big5.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'ctype.nlp' of multi-file assembly 'mscorlib.dll'<br />
ERROR: Unable to find file 'sortkey.nlp' of multi-file assembly 'mscorlib.dll'<br />
------ Pre-build validation for project 'Setup' completed ------<br />
------ Build started: Project: Setup, Configuration: Debug ------<br />
<br />
<br />
<br />
<br />
---------------------- Done ----------------------<br />
<br />
Build: 1 succeeded, 1 failed, 0 skipped<br />
|
|
|
|
|
You need to have MS .NET framework on target machine. You cannot just include the dlls and run your application.
It is possible to install the framework through your setup if it is not existing on the target machine. For that you need to include .NET redistributable with your setup.
- ashish
|
|
|
|
|
hi, thx
whats the .NET redistributable?
cu
|
|
|
|
|
i've made an application, i want to create an algorithmic to handle a serial number inputted by the user at the first running of the application, and understand if it is one of possible (correct) or not, in this way unlock or not the appliction.
Where can i start by?
How can avoid hacker see my assembly algorithm?
|
|
|
|