|
Could do but thats a big hack i think there has to be a nicer way
|
|
|
|
|
GOTCHA!!!
DataRow bishyBashy = ((DataRowView)(this.dataGridViewExistingSecurityLevels.SelectedRows[0].DataBoundItem)).Row;
|
|
|
|
|
Hi, I need your help to clarify the following.I try to run a method with the parameters on own thread. But I get the error.
public class MyQueue
{
Queue myQueue = new Queue();
public void Enqueue(PacketHeader p, byte[] s)
{
Data data = new Data(p, s);
myQueue.Enqueue(data);
}
}
m_myQueue = new MyQueue();
Thread thread = new Thread(new ThreadStart(m_myQueue.Enqueue(????)));
thread.Start();
Thanks in advanced
Mehran
|
|
|
|
|
Wrong threading type, look at the threading articles for .NET for the correct method (note this is a pun!) to do this
Well you could do this with properties, but if you just want to run a method this follow my above statement
|
|
|
|
|
|
NP, just be careful and be sure to call EndInvoke on your ISyncResult object, that is if the method is should to finish even if the caller would have ended first.
|
|
|
|
|
|
Google broken?
only two letters away from being an asset
|
|
|
|
|
If you don't want to google...
gogle[^]
gooogle[^]
googel[^]
ogogle[^]
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
An event is basically a list of delegates.
One part of your code (or different parts of the code) can subscribe to an event by adding one or more event handlers to the event. Another part of your code can invoke the event, which will call all the event handlers registered in the event.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
There goes my week! I always thought an event was a moment in time, that is remembered due to some action which took place guess I was wrong.
|
|
|
|
|
SpacixOne wrote: There goes my week! I always thought an event was a moment in time
You're wrong: it's a point in the four dimensional time-space.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi People,
First of: Im new in the world of C#.
I'm making a application that needs to connect to an access database.
Some gridviews will be filled with data that matches some criteria (eg. all invoicelines from one specific invoice), but there are also objects (eg. comboboxes) that will be filled without criteria.
I read allot bout dataset / typed dataset... I don't understand.
I googled but there is too much info which I don't understand.
I think I can savely say that most people prefer typed datasets?
What is my best option and where the h*ll do I start?
Besides: The location of my backend (access.mdb) needs to be variable.
Hope someone can get me on my way.
Thanks!!
Richard
|
|
|
|
|
A very broad and vague question, if there is one in your post. What are you trying to ask?
only two letters away from being an asset
|
|
|
|
|
Applogies! Youre right.
My question(s) is / are: what can I use best for my purpose? typed or non-typed datasets?
Is there any good tutorial regarding typed datasets?
Thanks,
Richard
|
|
|
|
|
RitchieRich wrote: what can I use best for my purpose?
The best method for your project is whats best. One technique may work well in one circumstance, but not in another.
Typed Datasets are of course just DataSets, so either will work, it all depends on what you want to do with it. If you are just binding the controls, then there isn't much need for a typed dataset. However, if you are manipulating the the dataset and want strong names and type safety, then by all means use a typed dataset. Do you even need a dataset, will a datatable server the purpose?
only two letters away from being an asset
|
|
|
|
|
Well.. i need to manipulate data in e.g. a gridview.
Preferbly I just have a ' direct' connection to the database when I make some changes in the gridview the changes are directly commited to the database. (that was in access the case)
As you can probably tell, im a newbie on this topic.
Do you have any good suggestions where I should begin with C# ??
Thanks
Richard
|
|
|
|
|
<code>Public Sub MassReplace()
With Application.FileSearch
.LookIn = "C:\AWCzx10" ' where to search
.SearchSubFolders = True ' search the subfolders
.FileName = "*.TXT" ' file pattern to match
'NOTE: I got this code from a friend, I do not know who originally wrote it so all credits go to the owner.
' I need to be able to batch edit the documents TXT files
If .Execute() > 0 Then
' to display how many files this macro will access,
' uncomment the next line of code
' MsgBox "Found " & .FoundFiles.Count & " file(s)."
' for each file you find, run this loop
For i = 1 To .FoundFiles.Count
' open the file based on its index position
Documents.Open FileName:=.FoundFiles(i)
'there are a bout 20 different items being swapped or removed here
'so I just listed a couple to keep it simple
'***************************************HERE WE GO *******
'ActiveWindow.ActivePane.View.Zoom.Percentage = 200
' Selection.Find.ClearFormatting
' Selection.Find.Replacement.ClearFormatting
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "Mz01"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "M2z07"
.Replacement.Text = "M5zz1 trr455 sd65y"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
'the list goes on and on
'************************************END OF SWAPPING FOR ALL FILES****
' save and close the current document
ActiveDocument.Close wdSaveChanges
Next i
Else
' if the system cannot find any files
' with the .doc extension
MsgBox "No files found."
End If
End With
End Sub
</code>
I need to load the code on a simple form with a button that executes the code, plain and simple with no input from the user.
I loaded the reference to the XPias, but I can not successfully transfer the code over.
Thank You in advance!
|
|
|
|
|
Steps to converting VBA to c#
1) Convert into VB.NET and run it though a VB.NET to C# converter and edit the crappy converted code to good code
2) ???
3) Profit!
|
|
|
|
|
Thank you for your reply (and for taking the time...), just to make the point clear this is NOT a "For profit" application. I have like 700+ files I need to perform multiple edits to. The issue is that if I knew how to transfer it over to VB.NET I would have done, but unfortunately I don't.
Any ideas are greatly welcome.
Appreciate the help.
|
|
|
|
|
To do what that VBA is doing (in MS office) it would required MS office automation (profit thing was just a referance to the Underpants Gnomes[^])
|
|
|
|
|
Hello,
You are right I would need the VSTFO to program for Word persay, but I think there is a different (easier way) to achieve the same results using the "StreamReader". I got this code from someone else (don't know where it came from): (NOT coded by me ALL credits to the author)
The thing is to be able to search for multiple "words" or "code" and be able to replace just as the aforementioned word macro does.
string find = txtFind.Text; <br />
int replaced = 0;<br />
<br />
string[] fileList = Directory.GetFiles(@"C:\text files", "*.txt", SearchOption.AllDirectories);<br />
<br />
foreach (string file in fileList)<br />
{<br />
StreamReader sr = new StreamReader(file);<br />
string content = sr.ReadToEnd();<br />
sr.Close();<br />
<br />
if(ReplaceText(ref content, txtFind.Text, txtReplace.Text, ref replaced))<br />
{<br />
StreamWriter sw = new StreamWriter(file);<br />
sw.Write(content);<br />
sw.Flush();<br />
sw.Close();<br />
} <br />
}<br />
MessageBox.Show("Total replacements = " + replaced);<br />
|
|
|
|
|
I got the program to work the way I need it, the problem now is to be able to select multiple items and to individually swap one by one I guess.
|
|
|
|
|
i want source code wordpad in c# please healp me
|
|
|
|
|
negar777 wrote: i want source code wordpad in c# please healp me
[STAThread]
static void Main()
{
} I leave the rest up to you.
|
|
|
|