|
manoj dhunelg wrote: Since I have very few days Then you have a lot of work to do; start here[^].
|
|
|
|
|
You have "very few days" for a final year project? And you picked THIS topic?? What do you mean by "very few days"?? How many are we talking about?? If it's a couple of weeks, you MIGHT be able to pull this off by pulling very long days to work on this project, but since you don't have any neural network experience, I seriously doubt it.
|
|
|
|
|
Hi
I need to force users to write in and fill forms using "English". And they cant be able to change language by pressing "Alt+ Shift".
thanks a lot for your helps...
|
|
|
|
|
Now that's all very nice, but you forgot to ask a question.
Regards,
Manfred
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
This would be tricky. If you just want to ensure script used is English, it is easy. Just scan every character in the input and make sure all the characters are valid English letters. But user can write another language using the English script. Detecting this would be tough and you need to use some natural language processing libraries.
Best wishes,
Navaneeth
|
|
|
|
|
Why does it matter? In "English" you can still type random crap in the form (and if you think that means ascii-only, consider pasting and alt-codes), so you'd still have to deal with it.
|
|
|
|
|
a simple way is in textbox keypress event! check if user pressed alt or shift , show a messagebox and inform to user that he/she cant use this feature
and if user changed language before activating textbox, you can check first charecter with textchanged event, if it is a charecter belong to persian (for example) ... with a message box say to user must change his/her language first
|
|
|
|
|
Spell check using an english dictionary.
|
|
|
|
|
i am trying to download some data from one website i succesfully navigate to the page and invoke click and it is navigate to next page .in the second page there is an iframe which is loading from another url . when am checking document text in my documentcompleted event handler the iframe part is showing youdont have permission to acces the page but in webbrowser control the whole page is showing..
Can anyone have any idea about the problem?
|
|
|
|
|
If iframe is pointing to a different domain, you will not get access to manipulate it's contents. This is basic security model exposed by browsers. I think you won't be able to workaround this. Check out this[^] MSDN article.
Best wishes,
Navaneeth
|
|
|
|
|
Hey Guys,
I know I can access my ItemTemplated Checkbox this way:
foreach (GridViewRow rowItem in GridView1.Rows)
{
CheckBox ckBxSelect = ((CheckBox)rowItem.FindControl("chkBxSelect"));
if (ckBxSelect.Checked)
{
Response.Write("True");
}
}
Ive built 1 LINQ object joined from 2 Datatables which comes from 2 WebServices. My GridView is bound to my LINQ object. When the user clicks submit, a foreach loop inserts that LINQ object into my database like so:
protected void Button1_Click(object sender, EventArgs e)
{
mySQLDatabaseDataContext dbc = new mySQLDatabaseDataContext("Data Source=JBBBZ7V1\\SQLEXPRESS;Initial Catalog=WLSData;Integrated Security=True");
mySQLTableName newRecord;
foreach (var item in LINQobject)
{
newRecord = new mySQLTableName();
newRecord.CustName = forAppr.custName;
newRecord.Status = "";
newRecord.DateTimeSubmitted = DateTime.Now;
dbc.mySQLTableName.InsertOnSubmit(newRecord);
}
dbc.SubmitChanges();
}
Like I said, my checkbox is in a TemplateField like so:
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
GridLines="Both"
CssClass="mGrid">
<Columns>
<asp:TemplateField HeaderText="Select">
<HeaderTemplate>
<asp:CheckBox ID="chkBxHeader" runat="server" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkBxSelect" runat="server"/>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
</asp:TemplateField>
</Columns></asp:GridView>
When I am inserting from my LINQ object, I would like the "Status" field to update with "True" if checkbox is checked or "False" if checkbox is not checked. Like so:
protected void Button1_Click(object sender, EventArgs e)
{
mySQLDatabaseDataContext dbc = new mySQLDatabaseDataContext("Data Source=JBBBZ7V1\\SQLEXPRESS;Initial Catalog=WLSData;Integrated Security=True");
mySQLTableName newRecord;
foreach (var item in LINQobject)
{
newRecord = new mySQLTableName();
newRecord.CustName = forAppr.custName;
if(ckBxSelect.Checked)
{
newRecord.Status = "True";
}
Else
{
newRecord.Status = "False";
}
newRecord.DateTimeSubmitted = DateTime.Now;
dbc.mySQLTableName.InsertOnSubmit(newRecord);
}
dbc.SubmitChanges();
}
However,
This code will throw an exception because of the object not being set to a reference.
Please help. Is there a better way do update my database?
Im totally lost.
|
|
|
|
|
|
RickSharp wrote: This code will throw an exception because of the object not being set to a reference. Then you need to fix that bug. Glancing at your code it seems you are using the variable ckBxSelect without setting it to refer to any object.
|
|
|
|
|
The only way I know how to refer to a checkbox in a TemplateField is by using GridViewRow in a foreach loop. If there is another way to find that control then i would love to know.
|
|
|
|
|
I don't know what relevance this has to do with my comment. If you do not understand the error "object not being set to a reference", then I would suggest rereading your C# documentation on objects and references.
|
|
|
|
|
Thanks for the insight. I'll go reread my C# manual...
So i read it, and I guess I'm too stupid to understand it. Maybe someone else can help.
|
|
|
|
|
I have resolved this issue by reading an asp lablel key into a dictionary. then if the dictionary had that label insert into my database. Sorry if I was vague but I'm very new to all of this so I mostly i just make others made by asking inane questions that are apparently to unclear to understand.
|
|
|
|
|
In a C# 2008 windows application, my initial install of the code obtained the message,
"Cannot access a disposed object.". This was valid at the time.
However now I corrected the problem in the code and reinstalled the corrected application. I am still getting the error message, "Cannot access a disposed object.".
Thus my question is once I reinstalled the corrected code why would I still be getting the message,
"Cannot access a disposed object."?
|
|
|
|
|
Reinstalling will have no effect. Your code is trying to access something that has been disposed. This is a bug in your code.
|
|
|
|
|
classy_dog wrote: why would I still be getting the message,
Because despite what you think you did, you did not fix it.
Some possibilities
- It is a different object, so a different bug.
- You are still running the old software (you didn't install the new stuff.)
- You didn't actually fix the bug.
|
|
|
|
|
When reading about IDisposable , I get the impression that the consensus is that once you introduce it, everything that's even heard about it need to be made IDisposable too. Can this really be correct?
I have a class DriverWrapper that holds an IntPtr to a DLL with a C interface. This class is IDisposable , and implements the standard Dispose pattern, with a finaliser. It also has a number of abstract functions, some delegate definitions, and a helper function to get a delegate from the loaded DLL.
From this class, I derive some other classes, which implements the abstract functions by creating delegates to DLL functions. (The reason for this is that I have three related DLLs, all doing effectively the same thing to different bits of hardware, so to a user in the application it makes sense that they all have the same, shared interface. Unfortunately, the DLLs have different names, and in some cases different signatures, for their functions.)
Now, the derived classes are already IDisposable from DriverWrapper, but if they only hold delegates, which aren't IDisposable themselves, is there any need to override Dispose(bool) in these? I think not, but I'm no expert on C#.
(Oh, and I'm not concerned with the using idiom, as these will be alive throughout the lifetime of their owner. Neither am I interested in whether I should implement it in case I will at some future point have a managed and disposable member, or hypotheticals like that.)
Next question:
There is an abstract base class Model which takes a DriverWrapper as a constructor parameter, and takes ownership of it. The classes derived from this only override one function, and are just meant to provide different types of DriverWrapper-derived classes. I'll need to have access to the DriverWrapper for the whole lifetime of the Model.
abstract class Model
{
DriverWrapper theDriver;
Model(DriverWrapper driver)
{
theDriver = driver;
}
...
}
class DriverWrapper : IDisposable
{
~DriverWrapper()
void Dispose()
void Dispose(bool)
}
class DriverA : DriverWrapper
{ ... }
class DriverB : DriverWrapper
{ ... }
class DriverC : DriverWrapper
{ ... }
class ModelA : Model
{
public ModelA()
: base (new DriverA())
{}
}
Would Model have to be IDisposable? Surely the DriverWrapper is now managed, and will be tidied away when the Model is? If not, would ModelA-C need to override Dispose even if they have no further data?
(Honestly, at times like this I really miss RAII and typedefs from C++)
|
|
|
|
|
Any classes derived from a disposable class are already disposable so there is no need to override Dispose(bool) unless it holds additional resources, in which case it should override, free the additional resources then call base.Dispose(disposing) .
Any wrapper classes that wrap a disposable class should be disposable so they can dispose the wrapped object properly.
|
|
|
|
|
Orjan Westin wrote:
When reading about IDisposable , I get the impression that the consensus is that once you introduce it, everything that's even heard about it need to be made IDisposable too. Can this really be correct? |
No, otherwise the whole framework would implement it.
Orjan Westin wrote: Would Model have to be IDisposable?
No, what you have is perfectly reasonable.
What can happen is that in taking control of when an object is disposed, it results in the impulse to chain IDisposable all the way up calling classes. Really you you only need to implement IDisposable where it makes sense: e.g. for memory performance or objects interacting with IO of some sort. As an example, I often write repository classes for EF/Linq TO SQL as the Datacontext is IDisposable and I want to pass the control of the datacontext's disposal up to the repository's controlling class I make the repository IDisposable but the calling class generally uses the using statement, or explicitly calls the destructor depending on the operations I am actually performing against the backing store.
|
|
|
|
|
Adding IDisposable never hurt anyone. A big part of me wishes Object had a Dispose and there was no interface -- I think that would be cleaner.
(This is not likely to be a popular opinion.)
|
|
|
|
|
PIEBALDconsult wrote: Adding IDisposable never hurt anyone. A big part of me wishes Object had a Dispose and there was no interface -- I think that would be cleaner. May be not. You don't have to Dispose() all the objects. Only those which holds up resources that needs deterministic cleanup.
PIEBALDconsult wrote:
(This is not likely to be a popular opinion.) True
Best wishes,
Navaneeth
|
|
|
|