|
public void PostPageURLS()
{
string strPostURL="";
string strPostId = "";
bool BreakFlag = false;
//
j=Convert.ToInt32(Thread.CurrentThread.Name);
for(int k=0; k<urls[j].count; k++)
="" {="" {
="" monitor.enter(thread.currentthread);
="" try
="" if(thread.currentthread="" !="null)
" j="Convert.ToInt32(Thread.CurrentThread.Name);
" }
="" catch(exception="" exc)
="" messagebox.show(exc.message);
=""
="" if(k<="" urls[j].count="" &&="" bi="" <="" blogurls.count)
="" string="" keyword="urls[j][k].ToString();
" int="" chpos="keyword.LastIndexOf("=");
" posttext="SearchKeywordsYahoo(keyword.ToString());
" +="SearchKeywordsMSN(keyword.ToString());
" bloglib.movabletypeinterface="" mti="new" webbloggenerator.bloglib.movabletypeinterface(posturls[bi].tostring());
="" object[]="" obj1="{objDT.Rows[(int)" checkedobj[j]].itemarray[0],objdt.rows[(int)="" checkedobj[j]].itemarray[1],objdt.rows[(int)="" checkedobj[j]].itemarray[2],
="" objdt.rows[(int)="" checkedobj[j]].itemarray[3],objdt.rows[(int)="" checkedobj[j]].itemarray[4],k*100="" urls[j].count,
="" "blogging"};
="" checkedobj[j]].itemarray="obj1;
" objdt.acceptchanges();
="" sss="(string)" posturls[bi];="" <-="" occurs="" exception
="" if(sss.indexof("msn")="" post(blogusername[bi].tostring(),blogpassword[bi].tostring(),posttext,urls[j][k].tostring());
="" excc)
="" bi++;
="" }
="" strpostid="mti.NewPost("",BlogUsername[bi].ToString(),BlogPassword[bi].ToString(),"New" post="" "="" +"="" !!!","<a="" href="+urls[j][k].ToString()+">"+urls[j][k].ToString()+" "+PostText,DateTime.Now,false);
if(Convert.ToInt32(mti.PublishPost(strPostId,BlogUsername[bi].ToString(),BlogPassword[bi].ToString()))>0)
{
// MessageBox.Show("Post Successful !!! "+str+ " " + th.Name);
}
else
{
// MessageBox.Show("Unsuccessful ???");
}
if(strPostId!=null ||strPostId!="")
{
WebBlogGenerator.BLL.PageUrl objPageUrl = new WebBlogGenerator.BLL.PageUrl();
int intPageUrlId=objPageUrl.UpdatePageURL(Convert.ToInt32(PageURLId[j][k]),Convert.ToInt32(BlogURLId[bi]),0);
}
bi++;
if(bi == BlogURLS.Count)
bi=0;
Monitor.Exit(Thread.CurrentThread);
Thread.Sleep(5000);
}
}
}
hope u understand that....
Thanks,
Pramod
|
|
|
|
|
hi all,
Actually i am a beginner in visual studio c# development and developing a software for our firm in c# (windows forms).
The main task of mine is to display the contents of the floppy when i click on the button in the windows forms and display the contents in the another window forms.Can anybody help me and guide me to go about it?
Nitin_ap
|
|
|
|
|
what do you mean with the word "content" ? is content Files list in Floppy Disk ? You can easily get files content of your floppy disk by using System.IO.Directory.GetFiles . You can get your Floppy Disk drive info by using System.Environment.GetLogicalDrives
good luck !
|
|
|
|
|
Is there a way to rename the hostname using C#?
thanX in advanced
|
|
|
|
|
|
The application that I have written perfroms additional tasks (editing INI, environment variables, XML) the only thing that I need to do is rename the hostname at this time.
|
|
|
|
|
I just started playing around with the Mdi Containers. I have one parent and four children that i open inside this parent form. what i want to do is check if a child form is already open inside of this parent, and if so it must be closed first, as to try and avoid the user from opening multiple child forms of the same child, if that makes any sense.
I've tried the Parent.hasChildren()
but that returns true no matter whether a child window is open or not.
Any help will be appreciated
Thanx in advance
|
|
|
|
|
Do something like this:
private void newWindowType1ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!ContainsChildForm(typeof(child1)))
{
child1 c = new child1();
c.MdiParent = this;
c.Show();
}
}
private void newWindowType2ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!ContainsChildForm(typeof(child2)))
{
child2 c = new child2();
c.MdiParent = this;
c.Show();
}
}
private bool ContainsChildForm(Type t)
{
for (int i = 0; i < this.MdiChildren.Length; i++)
{
if (t.IsInstanceOfType(this.MdiChildren[i]))
{
return true;
}
}
return false;
}
|
|
|
|
|
DigitalKing wrote: if (!ContainsChildForm(typeof(child1)))
Does not reconize ContainsChildForm
|
|
|
|
|
I posted the code for this function before, but here it is again:
private bool ContainsChildForm(Type t)
{
for (int i = 0; i < this.MdiChildren.Length; i++)
{
if (t.IsInstanceOfType(this.MdiChildren[i]))
{
return true;
}
}
return false;
}
|
|
|
|
|
That worked 100, but how do I get the focus back to that childform if it exists?
|
|
|
|
|
private void CreateUniqueChild(Type t)
{
int index = GetChildIndex(t);
if (index == -1)
{
Form f = (Form)Activator.CreateInstance(t);
f.MdiParent = this;
f.Show();
}
else
{
this.MdiChildren[index].Focus();
}
}
private int GetChildIndex(Type t)
{
for (int i = 0; i < this.MdiChildren.Length; i++)
{
if (t.IsInstanceOfType(this.MdiChildren[i]))
{
return i;
}
}
return -1;
}
private void newWindowType1ToolStripMenuItem_Click(object sender, EventArgs e)
{
CreateUniqueChild(typeof(child1));
}
private void newWindowType2ToolStripMenuItem_Click(object sender, EventArgs e)
{
CreateUniqueChild(typeof(child2));
}
|
|
|
|
|
private void newWindowType2ToolStripMenuItem_Click(object sender, EventArgs e)<br />
{<br />
if (!ContainsChildForm(typeof(child2)))<br />
{<br />
child2 c = new child2();<br />
c.MdiParent = this;<br />
c.Show();<br />
}<br />
else<br />
c.Activate();<br />
}<br />
<br />
private bool ContainsChildForm(Type t)<br />
{<br />
for (int i = 0; i < this.MdiChildren.Length; i++)<br />
{<br />
if (t.IsInstanceOfType(this.MdiChildren[i]))<br />
{<br />
return true;<br />
}<br />
}<br />
return false;<br />
}
|
|
|
|
|
thanx a mil, works like a bomb
|
|
|
|
|
after o add new column inside the datatable and bind into datagrid
DataColumn dc = new DataColumn();
DataTable dt = new DataTable();
dc.AutoIncrement = true;
dc.AutoIncrementSeed =1;
dc.Unique = true;
dc.ColumnName = "No";
dt.Columns.Add(dc);
SqlConnection objCN = new SqlConnection();
SqlCommand objCMD = new SqlCommand();
SqlDataAdapter objDA = new SqlDataAdapte();
objCN.ConnectionString = ConfigurationSettings.AppSettings["DSN"];
objCMD.Connection = objCN;
objCMD.CommandText = cmdText;
objCMD.CommandTimeout = 30;
objDA.SelectCommand = objCMD;
objCN.Open();
objDA.Fill(dt);
objCN.Close();
dGridRecord.DataSource = dt;
dGridRecord.DataBind();
but the new column 'No' i add in is not appear the increment number in my page after i run it.
wat value i need set data field for tis new column 'No' seem tis is auto generate number and no inside my database.
how i bind the 'No' column in my datagrid??
angela
|
|
|
|
|
Hi
i think you have done well but you have missed to set autoincrement step in yours code. so add the following line of code just after the line where you have set the autoincrementseed.
dc.AutoIncrementStep = 1;
i htink yours problem will be solved.
|
|
|
|
|
just now i set autoincrementseed,
dc.AutoIncrementStep = 1;
but the column 'No' also display nothing.....
i guess is my datagrid problem where i add a 'No'bound column but i not set d data field inside tat column... coz i dun know wat attribute to put in seem it no exit in my database, this column is auto generate number...
i also no sure whether i had bind the datatable to my datagrid correctly or not??
angela
|
|
|
|
|
have you made autogenerated column property of datagrid false? if you are using all the columns of datasource in datagrid then make it true. in that case you will not need to specify the column name for datagrid.
|
|
|
|
|
hi
if you are using all columns of datasource in datagrid then make true autogenerae column property of datagrid and if u still dont get the value then try to get it in debug mode n check that in table you are getting all values or not.
In debug mode you will get the place of error.
|
|
|
|
|
i already success to generate my autogenerate collumn
thanks for your guide
hav a nice week
angela
|
|
|
|
|
I have a windows form with a button that I have set the DialogResult property.
The button also has a click event.
When the click event fires, my event methods displays an MessageBox with Yes or No buttons. (an 'are you sure' type message)
If the user clicks the No button I want to cancel closing of the window form event.
How I can I achieve this.
Thanks
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
{
DialogResult dr = MessageBox.Show("Are you sure you want to close this window?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
this.Close();
}
}
|
|
|
|
|
The problem stems from button1 having it's DialogResult property set.
When button1 click event is fired, it executes button1_Click, displays the are you sure dialog and regardless of the result of the are you sure dialog will close the window form because it has a DialogResult set.
I was wondering if I could cancel this close window event depending on the result of the are you sure dialog.
I can simply not set the DialogResult property of button1, and set the DialogResult in the button1_Click event depending on the result of the are you sure dialog.
Regards.
|
|
|
|
|
Why not remove the DialogResult from button1 and assign it to the window only if it is closing:
private void button1_Click(object sender, EventArgs e)
{
DialogResult dr = MessageBox.Show("Are you sure you want to close this window?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
|
|
|
|
|
f(g) is a function with g defined as one parameter delegate function: g(*)
Now we want to calculate f(h(*,1)),f(h(*,2)),f(h(*,3)),f(h(*,4)).....
Is there a way to realize this application efficiently?
|
|
|
|